views:

14

answers:

0

Hi,

In my application I am using a custom httphandler. In this handler I have written this code:

static void Application_PreRequestHandlerExecute(object sender, EventArgs e)
{
    try
    {

        HttpContext.Current.Session["MyKey"] = "X";
    }
    catch (Exception ex)
    {
        throw;
    }
}

Now when I try to access my site with this URL: http://blahblah.com/ I get object reference error as HttpContext.Current.Session is null but when I am accessing my site with this url : http://blahblah.com/default.aspx i.e appending the default page I am not getting any error and I am able use that session key further. Could you please help me what is the issue with the first case ?