开发者

session variable timeout prob

i have get the username in session variable while im login, after i logged in i checked whether the session object(username) is null or not to get the username displayed in my page.if the session object is null i make the page to redirect to login page again. but at certain point if i click any link in any of my page after login it redirected me to Login page, but i havent开发者_如何转开发 click logout button. why it makes the session null. wat has to be placed to carry out the session variable througout the pages i visit, instead i click logout it should not be cleared / null- asp.net


Loss of session state is usually from either:

  1. Session timeout
  2. AppPool recycling due to inactivity (20 min) or daily forced recycle
  3. Trying to use a web garden or a web farm with InProc session state

Having said that, I would suggest using the ASP.NET Membership system instead of session state to record user login data. Either that or switch to cookies and get rid of sessions entirely.


It sounds like your session is timing out. You can increase this in your web.config – e.g.

<authentication mode="Forms">
   <forms loginUrl="xxxx" timeout="60"/>
</authentication>


Session can time out and all session variables are lost. So please check if that's the case.

http://msdn.microsoft.com/en-us/library/ms972429.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜