hi i used global variables on page_load event of my homepage. this is because these variables
are used by other pages.

i tested my page like COPYING THE URL then CLOSED ALL THE IE WINDOWS. and when i re opened IE,
and PASTED THE URL I COPIED, it seems that THE VARIABLES are remembered..what i want to achieve is that
even the user tried to copy the url, and closed his current window, he cannot access the page, hence,
a notification page will show.

please help..this is important for secutiry purposes.

thanks

Recommended Answers

All 5 Replies

It would help if you provide a sample of your relevant code

session?global variables?

No. You have to use Application object.

Post your code if possible.

i have a class named Globals.vb:

Public Class Globals
    Public Shared Id As String
    Public Shared userName As String
End Class

then, some pages im calling these variables for displaying and for queries:

Me.hdfID.Value = Id

or

select * from TABLE where ID='" & Id & "'"

just examples..these are working..

then when i tried to copy the url, and close the window, and re opened IE, and pasted the url, it remembers these variables that shouldn't be..how can i make this possible??
like the userName variable should be empty so, he should log in again.

it remembers these variables that shouldn't be..how can i make this possible??

You are using the Shared keyword. You shouldnt be using that unless you want to make it avaiable to every instance. See this article for full explanation: http://msdn.microsoft.com/en-us/library/zc2b427x.aspx

If you want the variable to be destroyed when the user closes the browser, use either a non-persistent cookie (client side storage) or session variable (server side storage).

Creating/Reading session variables: http://msdn.microsoft.com/en-us/library/ms178581.aspx

thanks for the reply..

anyway i used sessions and created a class for authorization checking.

i tested and it worked..thanks.. :-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.