Check if Session is still alive
-
Well.. this is not the simplle check if Session == null. In a global.asax file I log in a table the sessionID of a user. In the Session_End i add to that logline the date the session expired. well that works! But if a user chooses to close the browser in stead of logging out of an application....The additional logline with date session expiration is not saved. In an overview page I see that according to the database some sessions are days old while the session timeout is set for 2 hours. When I retrieve the data from the database is it possible to check with the IIS server if the found SessionID in the database is still valid for IIS?
In Word you can only store 2 bytes. That is why I use Writer.
-
Well.. this is not the simplle check if Session == null. In a global.asax file I log in a table the sessionID of a user. In the Session_End i add to that logline the date the session expired. well that works! But if a user chooses to close the browser in stead of logging out of an application....The additional logline with date session expiration is not saved. In an overview page I see that according to the database some sessions are days old while the session timeout is set for 2 hours. When I retrieve the data from the database is it possible to check with the IIS server if the found SessionID in the database is still valid for IIS?
In Word you can only store 2 bytes. That is why I use Writer.
Does this CP article give you any ideas? ASP.NET HttpModule for handling session end with StateServer[^]
-
Well.. this is not the simplle check if Session == null. In a global.asax file I log in a table the sessionID of a user. In the Session_End i add to that logline the date the session expired. well that works! But if a user chooses to close the browser in stead of logging out of an application....The additional logline with date session expiration is not saved. In an overview page I see that according to the database some sessions are days old while the session timeout is set for 2 hours. When I retrieve the data from the database is it possible to check with the IIS server if the found SessionID in the database is still valid for IIS?
In Word you can only store 2 bytes. That is why I use Writer.
Obviously you can assume any session over two hours is not valid. A common practice I've noticed for this situation is to use a bit of AJAX to capture the browser events, whether an actual close or just navigating away from your site, and update the database to logout the user.
only two letters away from being an asset
-
Does this CP article give you any ideas? ASP.NET HttpModule for handling session end with StateServer[^]
thank you. this is helping me investigating further on
In Word you can only store 2 bytes. That is why I use Writer.
-
Well.. this is not the simplle check if Session == null. In a global.asax file I log in a table the sessionID of a user. In the Session_End i add to that logline the date the session expired. well that works! But if a user chooses to close the browser in stead of logging out of an application....The additional logline with date session expiration is not saved. In an overview page I see that according to the database some sessions are days old while the session timeout is set for 2 hours. When I retrieve the data from the database is it possible to check with the IIS server if the found SessionID in the database is still valid for IIS?
In Word you can only store 2 bytes. That is why I use Writer.
digimanus wrote:
When I retrieve the data from the database is it possible to check with the IIS server if the found SessionID in the database is still valid for IIS?
No. You can't get this. Two things you can try, 1 - Handle browsers close event using JS and do AJAX call to update the database. This method is less reliable as JS can be manipulated from client side. 2 - Write a DB job which executes on specific intervals, check the validity of records and updates the records that are inactive for long time. For this to work, you may need to keep the last request time as well. :)
Navaneeth How to use google | Ask smart questions