System.Web.SessionState.SessionStateModule.OnReleaseRequestState C# (CSharp) Method

OnReleaseRequestState() private method

private OnReleaseRequestState ( object o, EventArgs args ) : void
o object
args System.EventArgs
return void
		void OnReleaseRequestState (object o, EventArgs args) {

			Trace.WriteLine ("SessionStateModule.OnReleaseRequestState (hash " + this.GetHashCode ().ToString ("x") + ")");

			HttpApplication application = (HttpApplication) o;
			HttpContext context = application.Context;
			if (!(context.Handler is IRequiresSessionState))
				return;

			Trace.WriteLine ("\tsessionId == " + container.SessionID);
			Trace.WriteLine ("\trequest path == " + context.Request.FilePath);
			Trace.WriteLine ("\tHandler (" + context.Handler + ") requires session state");
			try {
				if (!container.IsAbandoned) {
					Trace.WriteLine ("\tnot abandoned");
					if (!container.IsReadOnly) {
						Trace.WriteLine ("\tnot read only, storing and releasing");
						handler.SetAndReleaseItemExclusive (context, container.SessionID, storeData, storeLockId, storeIsNew);
					}
					else {
						Trace.WriteLine ("\tread only, releasing");
						handler.ReleaseItemExclusive (context, container.SessionID, storeLockId);
					}
					handler.ResetItemTimeout (context, container.SessionID);
				}
				else {
					handler.ReleaseItemExclusive (context, container.SessionID, storeLockId);
					handler.RemoveItem (context, container.SessionID, storeLockId, storeData);
					if (supportsExpiration)
						// Make sure the expiration handler is not called after we will have raised
						// the session end event.
						handler.SetItemExpireCallback (null);
					SessionStateUtility.RaiseSessionEnd (container, this, args);
				}
				SessionStateUtility.RemoveHttpSessionStateFromContext (context);
			}
			finally {
				container = null;
				storeData = null;
			}
		}