Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keeping Session From Timing Out

Status
Not open for further replies.

mac31415

Instructor
Feb 8, 2005
6
US
Is there a way to keep a session from timing out without using client side scripting?
 
I believe that session and timeout information is normally done in IIS. You could set the session info to a ridiculously large number (though there may be a limit I'm currently unaware of) in IIS, though am unaware of a way to keep a session from timing out specifically without javascript prompting the page to refresh every so often. You might also check out forum41 for more information on IIS.

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
Can't you just change the timeout limit in the web.config?

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
Yet another difference between ASP Classic and .NET. Hadn't realised that one... I would definitely go with ca8msm's suggestion...

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
Actually I have tried changing the values in web.config. However, it still timeouts in less than 5 minutes. (Does this imply that IIS is setup incorrectly?) One of the design requirements of the site is that it does not allow client-side scripting. It has to do it all server side. The clients have to remain on the page for sometimes upwards close to 3-4 hours. By the time they have input their data the site has timed out. Any other ideas?
 
Change the session timeout in IIS as well as the Web.config file

Rhys

""Vampireware /n/, a project, capable of sucking the lifeblood out of anyone unfortunate enough to be assigned to it, which never actually sees the light of day, but nonetheless refuses to die."

My Home
 
Thanks Rhys666. That is what I was looking for.
 
Now is there a simple way to tell how much time is left before the session expires?
 
Not really as the timeout is on the server and not the client (and if the server told the client then it would reset the timeout period!).

The closest you will get is a javascript timer that countsdown when a page loads (but it's not a perfect solution).

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
If you are wanting session vars to last for very long amount of time, like in a case where someone is filling a large finicial form that may stay on their computer for a day, then you can use a combination of viewstate and session.
Sub Page_Load()
If Session("AccountID") = nothing then
Session("AccountID") = Viewstate("AccountID")
else
Viewstate("AccountID") = Session("AccountID")
end if
end sub

Only use this when the only expection action is a post back so the expired session variable will refresh itself with the viewstate.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top