My app. stores login credentials in session variables, and checks against them as a first-step in loading any page. The session variables are created and populated only after the user has been verified against the login dataabse of allowed users. If the session
variables don't exist, then the user hasn't been authenticated and they're redirected to the login screen. How can I set the session timeout on the fly in my code? I'd like to have a different timeout for different areas of the site where security differs.
Is this possible? Also, the SessionState statement in the web.config file has a bunch of parameters I don't use (such as sqlConnectionString). Is there a way to use this statement to just get at the session timeout parameter and not have to use the other parameters?
Thx
Different areas of the site could have different timeouts. You would just need to reset the value appropriately each time the user moved from one area of the site to the other. Good luck!
But please read the answer to the question "Q: In InProc mode, I change the timeout value of a session programmatically, and that causes my Session_End to be called. Why? " in this FAQ: http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=7504 Also, regarding
the config section, you don't need to set any value to the attributes you don't use.
Patrick Y. Ng
ASP.NET Developer
This posting is provided “AS IS” with no warranties, and confers no rights.
Hondaman900
Participant
1136 Points
228 Posts
Changing session state timeout
Aug 25, 2003 11:30 PM|LINK
cthayer
Member
65 Points
13 Posts
Microsoft
Re: Changing session state timeout
Aug 27, 2003 10:53 PM|LINK
void Page_Load(object Sender, System.EventArgs e) { if (!IsPostBack) { Session["a"] = "a-value"; } Session.Timeout = 1; Response.Write(Session["a"]); }Different areas of the site could have different timeouts. You would just need to reset the value appropriately each time the user moved from one area of the site to the other. Good luck!Patrick Y. N...
Member
505 Points
99 Posts
Microsoft
Re: Changing session state timeout
Aug 28, 2003 11:53 PM|LINK
ASP.NET Developer
This posting is provided “AS IS” with no warranties, and confers no rights.