473,721 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I find when an ASP.NET session has expired?

I have an ASP.NET application that is using forms authentication and I want to know when a session has timed out

I have read quite a lot of posts here about this but no-one seems to have to same issue
Rather than telling the user that a timeout has occured I want to know on the server so I can call a stored procedure

Adding code to Session_End in global.asax doesn't help because this only gets called when Session.Destroy is called and not when a session simply dies

Does anyone have any ideas?

TI

David Popeck
Nov 18 '05 #1
2 5328
I don't know whether it could work or not.

Put a timer object in the a session variable with the same timeout of
the session.

On each request stop the timer in Page load and start at page unload.

Place the code to handle the request in a class.

I've thought of this and written it Without testing, so itmight be just
rubbish.

HTH

Stefano Mostarda MCP
Rome Italy

David Popeck wrote:
I have an ASP.NET application that is using forms authentication and I want to know when a session has timed out.

I have read quite a lot of posts here about this but no-one seems to have to same issue.
Rather than telling the user that a timeout has occured I want to know on the server so I can call a stored procedure.

Adding code to Session_End in global.asax doesn't help because this only gets called when Session.Destroy is called and not when a session simply dies.

Does anyone have any ideas?

TIA

David Popeck

Nov 18 '05 #2
Oh no, on the Page_Load sub routine of a each page just check
Session.IsNewSe ssion variable if it returns true, you know the session
expired.

example:

if (Session.IsNewS ession == true)
Server.Transfer ("default.aspx" );
"Stefano Mostarda" <st************ **@fastwebnet.i t> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
I don't know whether it could work or not.

Put a timer object in the a session variable with the same timeout of
the session.

On each request stop the timer in Page load and start at page unload.

Place the code to handle the request in a class.

I've thought of this and written it Without testing, so itmight be just
rubbish.

HTH

Stefano Mostarda MCP
Rome Italy

David Popeck wrote:
I have an ASP.NET application that is using forms authentication and I want to know when a session has timed out.
I have read quite a lot of posts here about this but no-one seems to have to same issue. Rather than telling the user that a timeout has occured I want to know on the server so I can call a stored procedure.
Adding code to Session_End in global.asax doesn't help because this only gets called when Session.Destroy is called and not when a session simply
dies.
Does anyone have any ideas?

TIA

David Popeck

Nov 18 '05 #3

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

Similar topics

4
39503
by: Ryan Hubbard | last post by:
I would like to limit multiple logins for a user. How and when does the session id expire? Can I set it so after x minutes of inactivity it would expire. How do I check if session id exists? If I can do these two things then I can store the session id for a user in a database and everytime he requests an action I can just check if the session id is active or expired. If active let him continue if expired request to relogin. If the...
4
6932
by: John | last post by:
Could anyone please help me on this?? I have a php script page, which is basically quiz. Visitors (after login in with their email address) are supposed to answer each question, and when they click the button at the bottom, the next page will show which problems they got right or wrong. Now my visitors, after seeing some problems they got wrong, click Back button at the Explorer menu, and if they do, they get the below message:...
0
2102
by: CJ | last post by:
Hi We have Session Data lost randomly and Session State expired early. Our Intranet Application uses Window Server 2003 and .Net Framework 1.1. We set Session Time out to 60 minutes. but user Session Data lost randomly and Session State sometime expired early. I pretty run out the solution to fix this problem. Althoug we use Web Farm but we have Sticky IP to let user request go to the same server all the time. We turn off the Web...
3
2441
by: Vijay | last post by:
Hi, Based on the session timeout, session will be expired. Timebeing , we are manually checking in the each page, whether the session is expired or not, If so,we are redirecting to common login page. Is it possible to avoid it by specifying the common login page in the web.config file? if so , can you send the relevant sample please? Thanks,
0
1721
by: nbdy9(nospam) | last post by:
I have a ASP.Net website (mobile). From time to time the browser popup the following message. Anyway to catch the error and redirect to my start page? saying, login.aspx? Thanks. ======================================================================= Server Error in '/mobSec' Application. The page requires session state that is no longer available. Either the session has expired, the client did not send a valid session cookie, or the...
4
1560
by: Peter Smith | last post by:
Will the below statement returns TRUE or FALSE iif the session is expired? (Request.UrlReferrer) Is Nothing I am using ASP.Net 1.1 and IIS 5.0. Thanks, Smith
15
13401
by: plsHelpMe | last post by:
Hi All, I am having a problem. I am using DOJO toolkits to fetch some data on my webpage. Now suppose if i leave my webpage for some time and the session gets expired and then i try to click on the link which invokes the DOJO(AJAX) call, it tries to re-authenticate and establish a session by itself. But, it then forwards me the authentication JSP as result of DOJO call instead of the intended JSP. PLease let me know how to track if the...
4
2438
by: sriram | last post by:
Hello Friends, I am new to this group so big HIIIIIIII to all :) fine i have a serious doubt about session handling in PHP. After 20 min (default time) session getting expired, session values are stored in a folder as a file, fine how php finiding that particular session expired? Because the files in session folder will not be deleted after 20 min but one session expired... Please explain me how this is happening? How php finds that...
5
3475
by: GrnMtn | last post by:
I've written a single load AJAX application that uses Session variables to store User information etc. Upon validating the username and password entered against the values stored in a database I wither the current session ID to a a variable as: Session("VSession") On each HTTP Request, I check the session for expiration. Function ValidateSession() ...
0
8837
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8728
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
9366
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9130
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
8005
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
6668
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
4484
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...
0
4751
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2129
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.