string logFile = "App_Data/ErrorLog.txt"; logFile = HttpContext.Current.Server.MapPath(logFile);
application_error
Exception exc = Server.GetLastError(); if (exc.GetType() == typeof(HttpException)) { // The Complete Error Handling Example generates // some errors using URLs with "NoCatch" in them; // ignore these here to simulate what would happen // if a global.asax handler were not implemented. if (exc.Message.Contains("NoCatch") || exc.Message.Contains("maxUrlLength")) return; //Redirect HTTP errors to HttpError page Server.Transfer("HttpErrorPage.aspx"); }
Exception exc = Server.GetLastError();
string appdatafolder = System.IO.Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, "App_Data"); string logFile = appdatafolder + "\\ErrorLog.txt";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)