Asp.net session state

During the launch session, the user has access to the Request object. How about ending the session, does it still have access to the Request object? For example, I want to count how many browsers are connected to my application.

Edit 1: If there is no access to the request object at the end of the session, what information does it have access to? Session ID, etc.

Edit 2: If the termination session cannot be used to track outages, how do I disable outage tracking in ASP.Net?

thanks

+1


a source to share


3 answers


Session_End will be triggered if you are using InProc.

Session_End will be triggered 1) after n minutes of inactivity (n = timeout value) or 2) if someone calls Session.Abandon ()

Session_End does not start when the browser is closed.



Session_End requires setting the session state.

If you want the original data of the Request.Browser, you should store it in session state.

During Session_End, it has access to the session state.

+1


a source


No, the request object is not available at the end of the session.



Note that the Session End only fires when Session.Abandon () is called from code, not when the session expires due to a natural timeout or whatever. Hence, it is not a reliable method for tracking outages.

+1


a source


from documentation

The Session_OnEnd event occurs when a session is abandoned or expires. Of the built-in server objects, only Application Object, Server Object, and Session Object Objects are available.

Notes

You cannot call the Server.MapPath method in the Session_OnEnd script. From default, Session_OnEnd operates as Anonymous user as defined for expression. In case there is a non-anonymous user or the logon for an anonymous user fails, the OnEnd function will not be called and the event will be logged.

0


a source







All Articles