473,758 Members | 2,401 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

redirect on Session Timeout

I would like to redirect to a logout page after a session has timed out. I
have placed a response.redire ct "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 7845
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*******@susc om.net> wrote in message
news:10******** *****@corp.supe rnews.com...
I would like to redirect to a logout page after a session has timed out. I have placed a response.redire ct "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*******@susc om.net> wrote in message
news:10******** *****@corp.supe rnews.com...
I would like to redirect to a logout page after a session has timed out. I have placed a response.redire ct "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*******@susc om.net> wrote in message
news:10******** *****@corp.supe rnews.com...
I would like to redirect to a logout page after a session has timed out. I have placed a response.redire ct "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******** ******@TK2MSFTN GP12.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*******@susc om.net> wrote in message
news:10******** *****@corp.supe rnews.com...
I would like to redirect to a logout page after a session has timed out.

I
have placed a response.redire ct "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.Append Header("Refresh ",
Convert.ToStrin g((Session.Time out * 60) + 5) & ";
URL=SessionTime out.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.Redire ct 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
3585
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 database randomly....otherwise it's always runs into a session time out.... **Also when i save new account info (You'll notice that i've been asked to put a save button near each record...so, it's not one global save it's by record), i'd like to be...
12
43194
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
5489
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
1948
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. Please show me how to set the timeout setting. Thanks. <sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false"
2
3944
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) ' Fires when the session ends Session.Timeout = 1 Response.redirect("Login.aspx")
20
3776
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 information will be lost. I've tried doing a Reponse.Redirect call back to my login page whenever I detected the Session is null, but I kept getting the exception saying "... Redirect not all in Page Callback".
3
2728
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 doing other things will a page of mine is up on the screen. But the session times out so that when I try and use a session variable, it crashes saying Object reference not set to an instance of an object. So I put <sessionState timeout="4800" />
4
7182
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 authentication so the default.aspx page will show up in the popup. So I'm looking into several options. 1. detect session timeout in javascript so that I prevent the popup from even happening. I can simply redirect or post to itself so that the calling...
7
7851
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 user knowing anything about it by ensuring all the essential objects ( only a few ) are in place during session start. For performance, there are some parts of the application which use static
0
9299
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9908
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9740
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8744
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7287
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3402
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2702
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.