Using Session variable in ASP.NET page

S

Stimp

When a user logs into my site, I create a cookie with their UserID, but
I wish to also create a Session variable to track their "UserType".

I do this as follows:

Session("UserType") = "admin"

(or whatever value I give the usertype)

I use this session variable to output a user-specific menu.

This works fine, until I pause using the page for about 5 minutes, then
when I go back to the page, the session variable has disappeared
(expired).

Is this expiry timeout something I need to set on the server, or is
there a better approach I should take to this problem using ASP.NET?

Thanks.
 
K

Kris

Hi,

If you are looking for session expiry event, you have to do this on the
server. This event would be available in Global.aspx.cs file.

Cheers,
Kris
 
S

Stimp

Hi,

If you are looking for session expiry event, you have to do this on the
server. This event would be available in Global.aspx.cs file.

Cheers,
Kris

actually I think I've found it... I can change the timeout flag in the
sessionState tag in web.config
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top