What can be done in Session_End()?

S

Savin Igor

What can be done in Session_End()?

Can I get something from Session[] in this handler?

My Global.asax.cs is below

using System;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.SessionState;

namespace SD
{
/// <summary>
/// Summary description for Global.
/// </summary>
public class Global : System.Web.HttpApplication
{
protected void Application_Start(Object sender, EventArgs e)
{

}

protected void Session_Start(Object sender, EventArgs e)
{
HttpContext.Current.Session["QWERTY"] = 9;
}

protected void Application_BeginRequest(Object sender, EventArgs
e)
{

}

protected void Application_EndRequest(Object sender, EventArgs e)
{

}

protected void Application_AuthenticateRequest(Object sender,
EventArgs e)
{

}

protected void Application_Error(Object sender, EventArgs e)
{
int i = 0;

}

protected void Session_End(Object sender, EventArgs e)
{
int i = (int)HttpContext.Current.Session["QWERTY"];
i++;
}

protected void Application_End(Object sender, EventArgs e)
{

}
}
}

When Session_End() is raised HttpContext.Current.Session gives me
NullReferenceException. I have no other plkaces where my
session-hosted var can be modified. Developing platform - VS2003 +
W2000 Server SP3
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top