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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ending Session Variables

Status
Not open for further replies.

suzi2

Technical User
Mar 4, 2002
22
GB
Can anyone help?

When a session times out, a lot of my pages throw back errors. I understand what has happened, but my users won't. How can I display a message asking them to log in again automatically when the session times out?

Thanks
 
Hi suzi,
Did you know that you can set a limit to when your sessions will timeout? Not sure if that will help you with this problem but it might... All you would have to do after defining how long you want your session to last do an if statement saying that if that amount of time has been surpassed to do a redirect to another page to log back in!

Here's some example code to define how long your sessions last!

<html>
<body>

<%
response.write(&quot;<p>&quot;)
response.write(&quot;Default Timeout is: &quot; & Session.Timeout & &quot; minutes.&quot;)
response.write(&quot;</p>&quot;)

Session.Timeout=30

response.write(&quot;<p>&quot;)
response.write(&quot;Timeout is now: &quot; & Session.Timeout & &quot; minutes.&quot;)
response.write(&quot;</p>&quot;)
%>

</body>
</html>

Hope this helps! Candie ;o)

&quot;Never forget what you learn & learn from what you forget!&quot;
 
Hi

Code:
<%
If session(&quot;yourvariable&quot;)=&quot;&quot; then response.redirect(&quot;pleaseloginagainpage.asp&quot;
%>

If you combine this with the increase in session timeout as Candie so elegantly described you are on to a winner

[fish] Derren
[Mediocre talent - spread really thin]
 
Thanks guys - have now got some wizardry in place.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top