0

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

2
  • you need to show your sssion check? Commented Dec 7, 2009 at 6:35
  • Are you putting the username into session on successful authentication/login? Commented Dec 7, 2009 at 7:07

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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>

1 Comment

Session timeout belongs to <sessionstate> tag.
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.