Reputation: 560
What happens behind the scenes if you don't explicitly define Session_Start
and Session_End
in the global.asax? Does your program just assume that it's there?
Have an internal app I was working on recently who's global didn't have these defined, and the program started having a few session timeout issues. They seemed to be resolved once I added these functions.
Upvotes: 0
Views: 83
Reputation: 1
If you would like to track the Session start time, you could add a session variable like "SessionStartTime" to Session_Start.
Upvotes: -1
Reputation: 239380
Session_Start
and Session_End
are just hooks. They are not required and the functionality of sessions is not affected one way or another by whether or not you override them in Global.asax.
I'm not sure what the source of your timeout issues were, but if they were corrected, it was done by whatever you did in those overrides, not by the mere presence of the overloads.
More technical detail
I hinted at it above, but I figured I should be more explicit. The class, System.Web.HttpApplication
, which is derived from in Global.asax
, has a number of "hooks" defined on it. Essentially, these are just placeholders allowing you inject functionality at key points in time. In other words, when ASP.NET needs to create a session, as part of that action, it calls Session_Start
. The default implementation does nothing, but if you override it in your derived class, then the code in that override runs.
Upvotes: 3