I think you're missing the point: When you are not using the in-process method for the session, there is no means of determining when the session expires exactly. You could possibly run a test to see if the session has expired, but this would mean that
the page is still open on the client and that you have some process testing for the session (which, of course, could end up extending the session based on how the session is supposed to expire). As I mentioned in a previous post, I included a link so that
you can review.
Why is this necessary?
Christopher Reed, MCT, MCSD, MCPD, Microsoft Specialist, MTA, MCTS
"The oxen are slow, but the earth is patient."
It is required for my situation because i want to maintain log for session expiry. I will have a page which show data for each session expire through signalr push technology.
is it possible to write any server side routine which detect session expiry? If u aware of such routine then please share with me.
The reason for using Session_OnEnd is because you would have your session data in memory and it would not to be cleaned up. Session_OnEnd is used by the web server to ensure that the session memory is deleted; otherwise, you would have memory orphaned on
the system, thus introducing a memory leak condition that may lead to the system running out of memory and crashing.
With the SQL Server option, there is no need to remove session memory from the system because there isn't any. Session_Start is used to create the SQL Server entry, but since SQL Server will handle the session data, Session_OnEnd is no longer needed and
is not used.
So, I'm not sure if there is a definitive way to determine when the session actually expired, except for creating a custom session-state mode.
Christopher Reed, MCT, MCSD, MCPD, Microsoft Specialist, MTA, MCTS
"The oxen are slow, but the earth is patient."
Participant
1347 Points
2399 Posts
Session end fire when we manage session in sql server
Jan 24, 2015 11:57 AM|mou_inn|LINK
guide me what happen for session end event when session is managed in sql server?
i want to write log to file when session end happen for a each logged in user. so guide me how to do it when session is managed in sql server? thanks
Star
13130 Points
4049 Posts
Re: Session end fire when we manage session in sql server
Jan 24, 2015 12:25 PM|Careed|LINK
It doesn't. The SessionEnd is designed not to fire when using either StateServer or SQLServer modes.
Look here for an alternative: http://forums.asp.net/t/1347992.aspx?Session+end+event+for+StateServer+SQLServer
"The oxen are slow, but the earth is patient."
Participant
1347 Points
2399 Posts
Re: Session end fire when we manage session in sql server
Jan 24, 2015 01:19 PM|mou_inn|LINK
so you means session never expire when session is managed in sql server?
All-Star
25756 Points
7014 Posts
Re: Session end fire when we manage session in sql server
Jan 24, 2015 02:10 PM|hans_v|LINK
No, the session will expire, but the event Session_End doesn't fire so you can't use it.
Participant
1347 Points
2399 Posts
Re: Session end fire when we manage session in sql server
Jan 26, 2015 05:36 AM|mou_inn|LINK
How to detect session expire with server side code when session managed in sql server? Help me with sample code.
Star
13130 Points
4049 Posts
Re: Session end fire when we manage session in sql server
Jan 26, 2015 07:52 AM|Careed|LINK
I think you're missing the point: When you are not using the in-process method for the session, there is no means of determining when the session expires exactly. You could possibly run a test to see if the session has expired, but this would mean that the page is still open on the client and that you have some process testing for the session (which, of course, could end up extending the session based on how the session is supposed to expire). As I mentioned in a previous post, I included a link so that you can review.
Why is this necessary?
"The oxen are slow, but the earth is patient."
Participant
1347 Points
2399 Posts
Re: Session end fire when we manage session in sql server
Jan 27, 2015 01:04 AM|mou_inn|LINK
is it possible to write any server side routine which detect session expiry? If u aware of such routine then please share with me.
Star
13130 Points
4049 Posts
Re: Session end fire when we manage session in sql server
Jan 27, 2015 06:15 PM|Careed|LINK
The reason for using Session_OnEnd is because you would have your session data in memory and it would not to be cleaned up. Session_OnEnd is used by the web server to ensure that the session memory is deleted; otherwise, you would have memory orphaned on the system, thus introducing a memory leak condition that may lead to the system running out of memory and crashing.
With the SQL Server option, there is no need to remove session memory from the system because there isn't any. Session_Start is used to create the SQL Server entry, but since SQL Server will handle the session data, Session_OnEnd is no longer needed and is not used.
So, I'm not sure if there is a definitive way to determine when the session actually expired, except for creating a custom session-state mode.
"The oxen are slow, but the earth is patient."