Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 30th, 2006, 01:29 PM
Banned
 
Join Date: Jul 2005
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default Redirect User Before Session.Timeout

I have a page that's written in ASP with VB syntax. I'd like to create a script or function that redirects the user to a logoff page before their session.timeout = 0. That's because the logoff page will add a 'False' flag to a DB table in SQL Server 2k with the use of their AccountID. Does anyone know of an easy way to do this? Thanks for any help.

KWilliams
 
Old June 30th, 2006, 03:45 PM
Friend of Wrox
 
Join Date: Nov 2005
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Are you saying you want a user to automaticly log of when the session time is over. I think you should use clientside javascript for this problem I think you can't accomplish this throuh asp vb only

__________________________________________________ ________
This is my junk I'm gona eat it
 
Old June 30th, 2006, 04:10 PM
Banned
 
Join Date: Jul 2005
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello DjKat,

I actually did find a JavaScript solution for this at http://www.eggheadcafe.com/forums/F...D=74538&INTID=3.

This solution works great at notifying the user when their session is about to timeout. This is because my site is dynamic, so each page is loaded as a script from the one main page currentpage.asp. Here's the code:

<script language="javascript" type="text/javascript">
<!--
function checker()
{
reply = false;
reply = confirm('Your session will expire in 5 minutes. Do you want to continue?')
if (reply)
{
//Redirect to current page to extend sessions
window.location="currentpage.asp"
}
else
{
//Redirect to logoff.asp
window.location="logoff.asp"
}
//1 second equals 1000 milliseconds
setTimeout("checker()", 10000); //10 seconds
}
//-->
</script>

Response.Write("<body onLoad=""setTimeout('checker()', 10000);"">")

I also used a simple server-side script to redirect the user when the session has timed out:

If Session("Group") = "" Then
Response.Redirect("logoff.asp")
End If

So now I'll set the times to work with the standard 20 minute timeout, and it should work fine. Thanks for your input.

KWilliams
 
Old July 1st, 2006, 01:18 PM
Authorized User
 
Join Date: Jun 2003
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to erobb Send a message via Yahoo to erobb
Default

Im just thinking out loud.

How about using the global asa and when the session expires there you tell the server to redirect them to a page. Of course you have already set the data you need in cookies on their browser so just because the session has expired does not mean you still dont have access to the info you need.

Earl
www.jhdesigninc.com








Similar Threads
Thread Thread Starter Forum Replies Last Post
Session timeout... rupen Classic ASP Professional 1 January 3rd, 2007 09:35 AM
session timeout bikki_suresh ASP.NET 1.0 and 1.1 Professional 1 October 11th, 2006 07:33 AM
session timeout bikki_suresh ASP.NET 1.0 and 1.1 Basics 0 October 10th, 2006 12:16 AM
Redirect User Before Session.Timeout kwilliams ASP.NET 2.0 Basics 1 June 30th, 2006 01:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.