Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-22-2007, 12:51 AM   PM User | #1
WilliamHolmes
New Coder

 
Join Date: Jun 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
WilliamHolmes is an unknown quantity at this point
Question Global.asa Session_OnEnd Problem

Hi,

Im having some problems with the Sub Session_OnEnd within the Global.asa

It doesnt seem to want to trigger.

Code:
Sub Session_OnEnd
Application.lock
Application("ActiveUsers") = Application("ActiveUsers") - 1
Application.unlock
response.Redirect("http://www.yourdomain.com/Session_End.asp")
End Sub
All i want to do is response.redirect the user that his/her session has ended (of course only if he/she is still on the website)

Any ideas ?
WilliamHolmes is offline   Reply With Quote
Old 06-22-2007, 04:36 PM   PM User | #2
WilliamHolmes
New Coder

 
Join Date: Jun 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
WilliamHolmes is an unknown quantity at this point
Thumbs up

Ok after some research i found that this is a common problem.

So... this is my solution...

i have an include page in all webpages on my website pages so i included the following within it..

My Session.timeout = 30

Within the include asp file i have ...
Code:
<% if Session("login") = "true" then %>
<script language="javascript">
//this will call the javascript method _SessionExpired after 20 minutes

setTimeout( "_SessionExpired()", 31 * 60 * 1000 );

function _SessionExpired()
{
alert('Your Session had Expired')
location.href = "http://www.mydomain.com/";
}
</script>
<%end if%>
I set the javascript timeout to 31 minutes to allow the session.timeout to completley timeout before the javascript.

This seems to work...as i change the page the session.timeout resets and so does the javascript.
WilliamHolmes is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:23 PM.


Advertisement
Log in to turn off these ads.