ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Iron Speed
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old July 15th, 2003, 04:13 AM
Agarash Agarash is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: South Africa
Posts: 53 Agarash User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 35 sec
Reputation Power: 6
Global.asa /Session Variables

hi there, im new here, and hopefully someone can help me

i have a logon page, i create session variables for every person who logs on, but when their session times out, i want to redirect them (or have a popup window) that tells them that they have been logged off, but i have no success.... this is my

global.asa:

<script language="vbscript" runat="server">

Sub Session_OnEnd
Response.Redirect "loggedout.asp"
End Sub

</script>

but it doesnt work, i set the timeout to 1 minute, and i lose the session variables, but i cant seem to redirect them to the loggedout page!!! please help

thanks
__________________
"Morgoth i Cried
All Hope is Gone
But i Swear REVENGE
Hear my Oath!!"

Reply With Quote
  #2  
Old July 15th, 2003, 06:29 AM
kkong's Avatar
kkong kkong is offline
Monkey Magic
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: UK
Posts: 103 kkong User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to kkong
hi,

in the global.asa file you should have something like this:

Code:
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
SUB Session_OnStart
  Session.TimeOut = 90
END SUB
</SCRIPT>


After that you need to set your session variable you want to check. Then at the top of each page have an include file which checks to see if that variable has been cleared. If so then force a re-direct to another page.

Code:
If Session("StrUsername") = "" Then
  Response.Redirect("Expirepage.asp")
End If


Kong.

Reply With Quote
  #3  
Old July 15th, 2003, 08:04 AM
Agarash Agarash is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: South Africa
Posts: 53 Agarash User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 35 sec
Reputation Power: 6
thanks, but i had a if staement like that already...

if session("name") = "" then
call javascript function()
end if

but it isnt happening!!! lets say my timeout is 2 minutes, i sit and wait for 5 minutes.. nothing happens... only then if a perform an action... does it call that javascriptfunction...

i put that my global.asa file looks exactly like you have it...

????

Reply With Quote
  #4  
Old July 15th, 2003, 08:11 AM
kkong's Avatar
kkong kkong is offline
Monkey Magic
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: UK
Posts: 103 kkong User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to kkong
Hi,

Just out of interest what happens if you replace your line where you call a javascript function and put instead just Response.Redirect("page.html").

By keeping all the code in ASP you should be able to confirm whether or not the session timeout is working.

Kong.

Reply With Quote
  #5  
Old July 15th, 2003, 08:21 AM
Agarash Agarash is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: South Africa
Posts: 53 Agarash User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 35 sec
Reputation Power: 6
hhmm... it still doesnt happen dynamically, it only happens after the timeout has passed and i perform an action.

wouldnt the global.asa pic it up, and cant i put a redirect in there??

thanks

Reply With Quote
  #6  
Old July 15th, 2003, 08:38 AM
kkong's Avatar
kkong kkong is offline
Monkey Magic
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: UK
Posts: 103 kkong User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to kkong
Hi,

with the above code the session.timeout is not checked until the user performs a request to a page, then it will go off and check.

I don't think the global.asa can do what your suggesting.

To make something pop-up dynamically would require a lot more work.. then just the above code.

I`ll have a scout about and see what I can find as I would be quite interested in being able to do that.

Kong.

Reply With Quote
  #7  
Old July 15th, 2003, 08:41 AM
Agarash Agarash is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: South Africa
Posts: 53 Agarash User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 35 sec
Reputation Power: 6
ive tried timers, but that doesnt work seeing as i want to measure INACTIVITY... exactly what sessions do...

thanks for the trouble

Reply With Quote
  #8  
Old July 16th, 2003, 01:39 AM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,712 Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 4 Weeks 1 Day 23 h 47 m 6 sec
Reputation Power: 688
response.redirect must go through the client browser, which may be long gone by the time the session.onend event fires (20 minutes of no activity by default). If the browser isn't there anymore the logout.asp page will never be hit, the server can't redirect there by itself.

Reply With Quote
  #9  
Old July 16th, 2003, 02:23 AM
Agarash Agarash is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: South Africa
Posts: 53 Agarash User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 35 sec
Reputation Power: 6
ive found something which avoids using session variables...
<html>
<head>
<script language="JavaScript">
var a, b;
function A()
{
b = 0;
a = window.setInterval("c()",1000);
}
function c()
{
b++;
document.d.e.value = b;
if (b == "5") {window.location = "www.page.html"};
}
function f()
{
b = 0;
}
</script>
</head>
<body onLoad="A();" onKeyPress="f();" onMouseMove="f();">
<form name="d">
<input type="text" name="e" value="">
</form>
</body>
</html>


a guy named Vosk.. thanks to him... this works perfectly.

Reply With Quote
  #10  
Old July 16th, 2003, 03:20 AM
Agarash Agarash is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: South Africa
Posts: 53 Agarash User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 35 sec
Reputation Power: 6
hey the code is straight forward..do you want me to explain it??

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Global.asa /Session Variables


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway