thx, this is true - it works by casting and I do watch out not having them
set as null.
But I still want to access the variables just as simple class (static)
properties; they are easier to access (global.UserId rather than (int)
Session("UserID")) and as I understand the case they are easier load on the
server
"re****@community.nospam" <ma**********@gmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
Variables/Classes are stored as "Objects" in your Session.
so you should do something like this
if (Session("UserID") is null) then
Session("UserID") = 100
Else
' session is already set to use it you have to cast it to an int
dim p as int = (Int) Session("UserID")
End if
I "think" this code will work. Basically you need to check to see if
the object exists. If it does not exist you need to initialize it to a
value.
If this does not solve your problem then try to rephrase your question
and provide more details.
Remember that Sesion Variables are specific to a user's web session
where as application are specific to the whole website.
Information about a user would be stored in a session. rmembering that
when the user is idle for more hten 20 minutes this information is
lost.
Information about the whole site woudl be stored in your Application.
This information is lost if the application is restarted for any reason
or the web server is restarted.