Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Session_End parameters?

Tags:

asp.net

Session_End in Global.asax in Asp.net has sender and eventargs parameters. Is there any documentation on what these parameters contain for Session_End?

like image 258
Karlth Avatar asked Mar 24 '26 01:03

Karlth


2 Answers

No. Not as far as I can find.

In fact it can be anything of course, but the source code tells us what is really raised:

 HttpApplicationFactory.EndSession(sessionState, this, EventArgs.Empty);

The actual call is done here.

The sender is the session state. The eventargs is set to EventArgs.Empty. (this is used as object here the event is raised on)

like image 76
Patrick Hofman Avatar answered Mar 26 '26 15:03

Patrick Hofman


After looking at the source of the HttpApplicationFactory class:

It doesn't matter whether the handler method is called Session_End or Session_OnEnd, both are handled the same and raised through HttpApplication.EndSession(..., object eventSource, EventArgs eventArgs), which is called from classes in System.Web.SessionState.

The eventSource will be the class raising the event and the EventArgs will be either EventArgs.Empty or some internal object containing session data.

But all of this is undocumented, so I had to stop digging as you shouldn't rely on it.

like image 36
CodeCaster Avatar answered Mar 26 '26 17:03

CodeCaster



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!