5
Answers

Object reference not set to an instance of an object.

satish kumar

satish kumar

13y
7.3k
1
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)