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.


4 Years
Discussion Span
Last Post by newbie26

session?global variables?

No. You have to use Application object.

Post your code if possible.

Edited by __avd


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


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.

Edited by newbie26


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.. :-)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.