Hi guys, privet vsem.
I had some problems installing nop on a site. Well actually that was my fault, but i saw the default error page only, not really informative.
May i suggest a solution?
It is like a page template in a root folder, like this
http://canadianconsumer.info/ErrorPageTemplate.htm
In HttpModule(NopCommerceFilter) i added a method at the end of Application_EndRequest:
private void CheckErrors(HttpContext httpContext)
{
if (httpContext.AllErrors == null || httpContext.AllErrors.Length == 0)
return;
try
{
const string errDesc = "<!--ErrorDesc-->";
string errors = string.Empty;
foreach (Exception e in httpContext.AllErrors)
{
Exception ex;
if (e.InnerException == null)
ex = e;
else
ex = e.InnerException;
errors += string.Format("Reason : {0}<br>Page : {1}<br><br>",
ex.Message, httpContext.Request.Url.AbsoluteUri);
errors += "<!--StackTrace : " + ex.StackTrace + "-->";
}
string path = httpContext.Server.MapPath("ErrorPageTemplate.htm");
string file = File.ReadAllText(path);
int pos = file.IndexOf(errDesc);
file = file.Insert(pos, errors);
path = path.Replace("Template", "");
File.WriteAllText(path, file);
}
catch
{ }
}
So if there are any unhandled exceptions(f.e., user was deactivated), user will see an error page with a reason and description.
http://canadianconsumer.info/ErrorPage.htm