So, after searching around for a good few hours and trying various methods I'm still at a loss as to how to make this work. I'm currently developing a new web application that needs to do lots of boring stuff on 'Session_End'. It would appear that all the material I've found on this subject suggests different approaches and most of which haven't worked for me , I also recently looked at Http modules but to no avail.
Hopefully someone can clarify the correct approach, and as always it's much appreciated. Code snippet below shows my current custom global.asax.cs, the problem is wiring up the Session_End().
Thanks!
public class MyGlobal : UmbracoApplication
{
public void Init(HttpApplication application)
{
application.PreRequestHandlerExecute += application_PreRequestHandlerExecute;
application.BeginRequest += this.Application_BeginRequest;
application.EndRequest += this.Application_EndRequest;
application.Error += Application_Error;
}
protected override void OnApplicationStarted(object sender, EventArgs e)
{
base.OnApplicationStarted(sender, e);
}
//Not sure how to hook this into Init()
private void Session_End(object sender, EventArgs e)
{
//Lots of great code
}
private void application_PreRequestHandlerExecute(object sender, EventArgs e)
{
try
{
if (Session.IsNewSession)
{
}
}
catch (Exception ex) { }
}
private void Application_BeginRequest(object sender, EventArgs e)
{
}
private void Application_EndRequest(object sender, EventArgs e)
{
}
protected new void Application_Error(object sender, EventArgs e)
{
}
}
}
Extending Global.asax for Session_End
Hi all,
So, after searching around for a good few hours and trying various methods I'm still at a loss as to how to make this work. I'm currently developing a new web application that needs to do lots of boring stuff on 'Session_End'. It would appear that all the material I've found on this subject suggests different approaches and most of which haven't worked for me , I also recently looked at Http modules but to no avail.
Hopefully someone can clarify the correct approach, and as always it's much appreciated. Code snippet below shows my current custom global.asax.cs, the problem is wiring up the Session_End().
Thanks!
Hello,
I'm using a custom Global.asax in the Hybrid Framework.
The file: https://github.com/jbreuer/Hybrid-Framework-for-Umbraco-v7-Best-Practises/blob/master/Umbraco.Extensions/Utilities/Global.cs
Register the file: https://github.com/jbreuer/Hybrid-Framework-for-Umbraco-v7-Best-Practises/blob/master/Umbraco.Site/Global.asax
You can probably just add the Session_End in there.
Jeroen
Hi Jeroen,
I've been meaning to take a look at the Hybrid Framework for a while now, it seems to deal with a lot of the problems I seem to be encountering.
I've just fixed my issue and it was fairly straight forward.
Made sure my Session_End() method was protected and not private
Added a timeout value to my web.config
Simple mistakes - I easily overlooked them and it cost me a fair amount of time.
Thanks.
is working on a reply...