问题
How we can set different session timeout in each part of a website in asp.net c#.
I know that we can manage session timeout by web config but when we change session timeout in web config the specified value set for all of my website but I want to manage session timeout in my program for example in administrator want to set session timeout 2 hours and in login user area set session timeout to 10 minute.
回答1:
You can change the SessionTimeout of the current HttpContext. When an administrator logs in, just change his timeout like this:
HttpContext.Current.Session.Timeout = 60;
http://forums.asp.net/t/1563991.aspx
来源:https://stackoverflow.com/questions/25381956/how-can-set-different-session-timeout