0

i am new to asp.net..please help me to write code for setting session timeout and how to implement in all pages,i tried out using web config method,but not getting,i am nearing to deadline. This is my code

3
  • Where is the code, what did you try and what do you meand "but not getting"? Have you activated session state at all? The default timeout is 20 minutes, so you should be able to read anything you store in Session state for at least 20 minutes. If you can't either your code is wrong or you haven't activated Session state at all. Commented Jul 31, 2013 at 8:31
  • possible duplicate of Session timeout in ASP.NET Commented Jul 31, 2013 at 8:32
  • add timeout=2000 in connection string. Commented Jul 31, 2013 at 8:45

2 Answers 2

2

From code:

Session.Timeout = 60; // this will set 60 min timout

From config:

<sessionState timeout="60" />
Sign up to request clarification or add additional context in comments.

Comments

1

Using Web.config

<sessionState
timeout="number of minutes"............

Full reference HERE !

or

Using Forms authentication

<system.web>
<authentication mode="Forms">
      <forms timeout="50"/>
</authentication>  
<sessionState timeout="60"  />
</system.web>

1 Comment

thanks..but i have one more doubt...will it be applicable to all pages,shall i need to do any coding for aspx.cs pages..reply please

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.