satish kumar

satish kumar

  • NA
  • 10
  • 63.1k

Object reference not set to an instance of an object.

Aug 16 2011 3:10 AM
Hi
I am trying to check whether the user is logged in or not in Global.asax as shown in code
but I am getting this error
Error: Object reference not set to an instance of an object.

code:
 void Application_BeginRequest(object sender, EventArgs e) 
        
    {
        if (HttpContext.Current.Request.Url.ToString().Contains("SystemUpload"))        
        {
            if (HttpContext.Current.Session["Login"] == null)
            {
                Response.Redirect("~/Login.aspx");
            }
        }
    }

could you kindly suggest me how to fix this issue.

thanks in advance

satish









Answers (5)