473,800 Members | 2,497 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 5334
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
39508
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
6934
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
2103
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
2443
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
1723
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
1563
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
13407
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
2442
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
3483
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
9691
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
9551
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
10507
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
10255
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
10036
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
9092
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
7582
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...
1
4150
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2948
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.