I would like to save details in the class to a database before the session is lost. If I rely upon Session_End in global.aspx, the object is already lost when I go to save it. I tried to implement idisposable in the cUserSession but this didn't fire. Whilst I can see how I can manually save the contents of the session by user action or property change, I would like to only do that when the session is about to be lost.
Public ReadOnly Property UserSession As cUserSession Get If HttpContext.Current.Session("UserSession") Is Nothing Then HttpContext.Current.Session.Add("UserSession", New cUserSession) End If Return DirectCast(HttpContext.Current.Session("UserSession"), cUserSession) End Get End Property
Do more with