473,795 Members | 2,443 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How Do You Detecting Session Timeout?

I realize that I can handle "SessionEnd " from global.asax ... but it appears
to me that this gets called without the context of a current web request. So
given the following scenario:

User logs in and session starts
User is inactive longer than the session timeout setting
Some thread, not associated with a request, detects the timeout and raises
Session_End()
The User comes back to the site presenting a timed-out session id
ASP.NET restarts the session (obviously without any data from the previous
session)

My question is, when the user returns with a timed-out session id, is there
a way for me to empirically determine that their session has timed-out? A
property that I am perhaps missing somewhere? I realize I can check their
session contents collection for a peice of data that would otherwise be
there, however this seems somewhat indirect to me and, in my particular
case, potentially not "complete" enough to make the determination.

Any thoughts are welcome,
TIA//
Nov 19 '05 #1
4 1658

I believe the only way of knowing is by the Session_End event. You can
catch it there but I don't know what good that would do. The only other
suggestion is to start a timer when there session starts and do
something if there is no activity before it ends. There are examples of
this in this forum.

Nov 19 '05 #2
when user hits the site with an expired session cookie, a new session is
created. in the new session event, look for the old session cookie in the
request( currently ASP.NET_Session Id)

-- bruce (sqlwork.com)

"Chris Newby" <CA************ *****@hotmail.c om> wrote in message
news:uF******** ******@TK2MSFTN GP14.phx.gbl...
I realize that I can handle "SessionEnd " from global.asax ... but it
appears
to me that this gets called without the context of a current web request.
So
given the following scenario:

User logs in and session starts
User is inactive longer than the session timeout setting
Some thread, not associated with a request, detects the timeout and raises
Session_End()
The User comes back to the site presenting a timed-out session id
ASP.NET restarts the session (obviously without any data from the previous
session)

My question is, when the user returns with a timed-out session id, is
there
a way for me to empirically determine that their session has timed-out? A
property that I am perhaps missing somewhere? I realize I can check their
session contents collection for a peice of data that would otherwise be
there, however this seems somewhat indirect to me and, in my particular
case, potentially not "complete" enough to make the determination.

Any thoughts are welcome,
TIA//

Nov 19 '05 #3
I considered that ... but it appeared that ASP.NET just renewed the old
session id ... are you sure about this?

"Bruce Barker" <br************ ******@safeco.c om> wrote in message
news:Oe******** ******@TK2MSFTN GP09.phx.gbl...
when user hits the site with an expired session cookie, a new session is
created. in the new session event, look for the old session cookie in the
request( currently ASP.NET_Session Id)

-- bruce (sqlwork.com)

"Chris Newby" <CA************ *****@hotmail.c om> wrote in message
news:uF******** ******@TK2MSFTN GP14.phx.gbl...
I realize that I can handle "SessionEnd " from global.asax ... but it
appears
to me that this gets called without the context of a current web request. So
given the following scenario:

User logs in and session starts
User is inactive longer than the session timeout setting
Some thread, not associated with a request, detects the timeout and raises Session_End()
The User comes back to the site presenting a timed-out session id
ASP.NET restarts the session (obviously without any data from the previous session)

My question is, when the user returns with a timed-out session id, is
there
a way for me to empirically determine that their session has timed-out? A property that I am perhaps missing somewhere? I realize I can check their session contents collection for a peice of data that would otherwise be
there, however this seems somewhat indirect to me and, in my particular
case, potentially not "complete" enough to make the determination.

Any thoughts are welcome,
TIA//


Nov 19 '05 #4
If all client browser instances haven't been closed
the Session ID will be recycled.

If all client browser instances have been closed,
a new Session ID will be issued.

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"Chris Newby" <CA************ *****@hotmail.c om> wrote in message
news:u0******** ******@TK2MSFTN GP14.phx.gbl...
I considered that ... but it appeared that ASP.NET just renewed the old
session id ... are you sure about this?

"Bruce Barker" <br************ ******@safeco.c om> wrote in message
news:Oe******** ******@TK2MSFTN GP09.phx.gbl...
when user hits the site with an expired session cookie, a new session is
created. in the new session event, look for the old session cookie in the
request( currently ASP.NET_Session Id)

-- bruce (sqlwork.com)

"Chris Newby" <CA************ *****@hotmail.c om> wrote in message
news:uF******** ******@TK2MSFTN GP14.phx.gbl...
>I realize that I can handle "SessionEnd " from global.asax ... but it
>appears
> to me that this gets called without the context of a current web request. > So
> given the following scenario:
>
> User logs in and session starts
> User is inactive longer than the session timeout setting
> Some thread, not associated with a request, detects the timeout and raises > Session_End()
> The User comes back to the site presenting a timed-out session id
> ASP.NET restarts the session (obviously without any data from the previous > session)
>
> My question is, when the user returns with a timed-out session id, is
> there
> a way for me to empirically determine that their session has timed-out? A > property that I am perhaps missing somewhere? I realize I can check their > session contents collection for a peice of data that would otherwise be
> there, however this seems somewhat indirect to me and, in my particular
> case, potentially not "complete" enough to make the determination.
>
> Any thoughts are welcome,
> TIA//
>
>



Nov 19 '05 #5

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

Similar topics

4
15470
by: DavidS | last post by:
First: There are several ways to confuse one regarding session timeout. (1) web.config - <sessionState timeout="20"> (2) IIS Manager | Internet Information Services | ServerNode | Default Web Site | Properties | Configuration | Options | Enable Session State Session timeout 20 (3) within Global.asax.vb file - Session_Start subroutine can use Session.Timeout=x minutes or (4) within any web page, i.e., <web page>.aspx can use...
4
2765
by: Chris | last post by:
When a request comes into a page on my ASP.net site and a session is not found, I want to detect whether the request is an initial request or if the user did have a session going that has now been lost and show an explanatory message before restarting the session. Rather than tagging a 'session in progress' flag on the end of every request querystring I'd like to detect it using data sent in every request. One idea I had was that when...
3
7385
by: Simon | last post by:
Hi all, Any help with this would be much appreciated: I have a site where the session needs to timeout because of security concerns. I want to send the user back to the login page if the session is expired. Whats happening at the moment is that objects that exisit in the Session are being accessed when the session has expired.
11
3013
by: Vishal | last post by:
Hello, can anybody tell me how I can extend the session expiry time? Is it done via code or via IIS? Sorry I am new and dont know about this.
4
9459
by: UJ | last post by:
I have a page where the user can upload a video file. As you can guess, this may take a while. Is there a way I can change the session timeout for just this one page? I would also want to change the forms authentication to be a large value for that page also. TIA - Jeff.
7
2050
by: Mike | last post by:
Hi. How can I detect if a user's session has timed-out? I'd like to be able to redirect the user to a specified page in the event of session timeout. Thanks!
2
11180
by: runner7 | last post by:
Can anyone tell me if there is a way in PHP to determine when a session times out on the server or how many concurrent sessions there are in your application?
9
5575
by: timor.super | last post by:
Hi group, I've written a client/server application, using the dotnet sockets. In my server, I have a thread waiting for messages with : ret = currSocket.Receive(buffer, 1024, SocketFlags.None); When the client exits, I close the socket with a specific message (like "end") and the thread terminate in a proper manner, but If my client crashes, the server is still waiting for receiving data, and
3
7600
by: Sems | last post by:
Hi I'm using the Session_End event in the global.asax to detect if a users sessions has ended. Is there any way to tell if the session end is due to it being expired and not abandoned? I'm trying to show the user a popup if their session has expired due to a timeout. Whats the best way to do this?
0
9672
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
9519
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
10438
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
10164
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
5437
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
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
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
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
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.