How can set different session timeout

守給你的承諾、 提交于 2019-12-13 07:33:35

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!