473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

redirect on Session Timeout

I would like to redirect to a logout page after a session has timed out. I
have placed a response.redirect "loggedoff.asp" in the Session_OnEnd
subroutine in the global.asa, but it does not move to the page after timeout
occurs.

Any suggestions?

Thanks in advance ....
Nov 18 '05 #1
6 7812
Although the Session_OnEnd event fires on the server with the session has
timed out, it does not cause the client page to reload, and thus the client
page knows nothing of the redirect.

What you could do is set a create a javascript function that runs on the
client, with the same wait time as the session time on the server. Once the
page loads, start the time. If it reaches the session time limit, it could
window.navigate to the desired page at about the same time as the server
would time out. If they move to a new page before the limit, the client
timer resets when the new page loads, as does the server timer. You could
even place this javascript in a user control that you could then drag and
drop on every ASP page that you want to use it on...

Hope that helps.

-Darrin


"Weave" <tw*******@suscom.net> wrote in message
news:10*************@corp.supernews.com...
I would like to redirect to a logout page after a session has timed out. I have placed a response.redirect "loggedoff.asp" in the Session_OnEnd
subroutine in the global.asa, but it does not move to the page after timeout occurs.

Any suggestions?

Thanks in advance ....

Nov 18 '05 #2
I've handled this with Meta refresh. After X seconds, redirect the user to
the loggedoff.asp page.
Works for both ASP and ASP.net. If you are not sure what this is, do a
search on google for Meta Refresh.

Michael
"Weave" <tw*******@suscom.net> wrote in message
news:10*************@corp.supernews.com...
I would like to redirect to a logout page after a session has timed out. I have placed a response.redirect "loggedoff.asp" in the Session_OnEnd
subroutine in the global.asa, but it does not move to the page after timeout occurs.

Any suggestions?

Thanks in advance ....

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.581 / Virus Database: 368 - Release Date: 2/9/2004
Nov 18 '05 #3
The best that I have come up with is this:
1. In the Session_OnStart event set the Session.Timeout property (do not
rely on the value in web.config) and set some Session variable e.g.
Session["IsAlive"] = true;
2. Include at top of each .aspx file a META tag to refresh the page for the
same amount of time as the Session Timeout property.
3. In the code behind for each page, in the Page_Load , check Session
variable, if it is null then Session has expired, and do redirect to page of
choice.

"Weave" <tw*******@suscom.net> wrote in message
news:10*************@corp.supernews.com...
I would like to redirect to a logout page after a session has timed out. I have placed a response.redirect "loggedoff.asp" in the Session_OnEnd
subroutine in the global.asa, but it does not move to the page after timeout occurs.

Any suggestions?

Thanks in advance ....

Nov 18 '05 #4
Thanks Darrin - worked like a charm!

"Darrin J Olson" <da************@sio.midco.net> wrote in message
news:eq**************@TK2MSFTNGP12.phx.gbl...
Although the Session_OnEnd event fires on the server with the session has
timed out, it does not cause the client page to reload, and thus the client page knows nothing of the redirect.

What you could do is set a create a javascript function that runs on the
client, with the same wait time as the session time on the server. Once the page loads, start the time. If it reaches the session time limit, it could
window.navigate to the desired page at about the same time as the server
would time out. If they move to a new page before the limit, the client
timer resets when the new page loads, as does the server timer. You could
even place this javascript in a user control that you could then drag and
drop on every ASP page that you want to use it on...

Hope that helps.

-Darrin


"Weave" <tw*******@suscom.net> wrote in message
news:10*************@corp.supernews.com...
I would like to redirect to a logout page after a session has timed out.

I
have placed a response.redirect "loggedoff.asp" in the Session_OnEnd
subroutine in the global.asa, but it does not move to the page after

timeout
occurs.

Any suggestions?

Thanks in advance ....


Nov 18 '05 #5
For those following this thread and who may be interested in yet another
way of doing this, put the following in Page_Load():
Response.AppendHeader("Refresh",
Convert.ToString((Session.Timeout * 60) + 5) & ";
URL=SessionTimeout.aspx")
My understanding is that the Response Header will cause a refresh
according to the Session.Timeout argument. Every time the page loads
this value gets reset.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #6
Hi Paul,
If I may add my two cents... Spiders/crawlers hate this kind of redirect.
They'll think you're spamming them. Calling Response.Redirect or
Server.Transfer is legit, though. Redirect sends a 302 code (page moved)
which is ok.
--
Milan Negovan
www.AspNetResources.com
Essential recources for ASP.NET developers
Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: HolaGoogle | last post by:
hi all, can you please tell me what i should do to avoid session timeout when displaying my database info in my asp form (DisplayUserDatabase.asp)??? ** actualy it does load and display the...
12
by: Geigho | last post by:
Setting session timeout in web.config file does not seem to have any effect. Any explanation or suggestion will be appreciated.
2
by: francois | last post by:
in my web.config i have the following : <sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
3
by: hn | last post by:
I tried to set session timeout =1 minute as seen below in my Web.config but it didn't work. I also tried to set the timeout in IIS as well and still the application doesn't time out after 1 minute....
2
by: Stephen Noronha | last post by:
Hi, I am creating a test applicaiton with 3 pages say login.aspx test1.aspx and test2.aspx. I added this to my global.asax file Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)...
20
by: Simon Says | last post by:
Hi, I've a login page in which after authenticating it via the Oracle DB, I will stored the user information into the Session. However, when the Session timeout occurs, all of the user...
3
by: Mufasa | last post by:
Folks, I'm having problems with my session timeout. People using my website leave it just sitting there while they do other things. They have logged in ( using Forms Authentication ) and will be...
4
by: goscottie | last post by:
I used submodal as my popup window. With some tweaks, it working great in my app. However, I can't find a way to detect session timeout in the popup window. The app is a form based...
7
by: Microsoft Newsserver | last post by:
Hi Folks. I have an issue I need some help with if thats OK. I am running Framework 2.0 using Windows Integrated Security. For most of the application we manage session timeouts without the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.