ASPxGridView – Object reference not set to an instance of an object

Solution

add to pproject global.asax

protected void Application_Error(object sender, EventArgs e)
{
//We save the error information to a file named Error.txt

        StreamWriter sw = new StreamWriter(Server.MapPath("~/error.txt"), true);

        sw.WriteLine(DateTime.Now.ToString());

        //Server nesnesini GetLastError metodu sunucuda oluşan son hatayı Exception tipinden getirir. Bu da şu an oluşan hata olacaktır

        if (Server.GetLastError().InnerException != null)

            sw.WriteLine(Server.GetLastError().InnerException.Message);

        else

            sw.WriteLine(Server.GetLastError().Message);



        //The Path property of the / Request object now returns the path information of the requested page

        sw.Write(Request.RawUrl != null ? Request.RawUrl : "");

        sw.WriteLine();

        sw.Close();
        Response.Redirect("Default.aspx");

    }

Leave a Reply

Your email address will not be published. Required fields are marked *