Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have a Session["Name"] = Obj.name
If the App is Idle for a long time , i am trying to access the Session["Name"] ,
its Null.

Session["Name"] = null;

Web.Config
<sessionstate mode="InProc" customprovider="DefaultSessionProvider">

I am not providing any timeout.
May be the default timeout = 20Min.
How can i provide an Infinite Timeout.

Any Help Plz!
Posted

You certainly don't want to set the timeout to infinite. You'll keep piling up resources and the server will eventually roll over and die.

I would not recommend setting the timeout higher at all. the session timer resets each time there is a postback, so timing out means the user didn't touch the application in over 20 minutes.

There are several things you can do:

1.
set the time out to a larger value. You can do this in IIS directly per application it's a real b... to navigate IIS so you'll need to search a bit.

2. You can reset the timer when it expires by using the events in the global.asax file.

3. You can do a postback via scripting each xx minutes.

4. (recommended) You can set a script timer to let's say 15 minutes and inform the user with a message like "careful, your session is about to expire in 5 minutes, please do x or y to continue the session."

I would not do 1, 2 or 3.

hope this helps.
 
Share this answer
 
In Your Applicaion Web.Config add the below Configuration...

XML
<system.web>
    <sessionState timeout="30">
      //here timout is in minutes
    </sessionState>
      </system.web>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900