we are trying to access the session variables on session end. We have created a new module called ApplicationSessionEventsHandlerModule and added a SessionEnd_Execute handler.
However, the Kentico SessionHelper class does not work and neither does System.Web.HttpContext.Current.Session. How do you recommend we access session variables on session end? See code:
public class ApplicationSessionEventsHandlerModule : Module
{
public ApplicationSessionEventsHandlerModule() :
base("ApplicationSessionEventsHandlerModule")
{
}
protected override void OnInit()
{
base.OnInit();
ApplicationEvents.SessionStart.Execute += SessionStart_Execute;
ApplicationEvents.SessionEnd.Execute += SessionEnd_Execute;
}
private void SessionEnd_Execute(object sender, EventArgs e)
{
if (SessionHelper.SessionIsAvailable)
{
if (SessionHelper.GetValue("UserDetails") != null)
{
//Do stuff
}
}
}
private void SessionStart_Execute(object sender, EventArgs e)
{
if (SessionHelper.GetValue("UserDetails") != null)
{
//do stuff
}
}
}