Q:
私が使用するELMAH
- Error Logging Modules And Handlers。
しかし、ユーザーに素敵なエラーページを表示したい.
私の質問には2つの部分があります:
このページに必要なデザインや情報はありますか。(要件) .任意の提案、リンクは素晴らしいでしょう。
行にコメントする
Clear error
と、エラーページがユーザーに表示されます。それ以外の場合、エラーページは表示されません。エラーをクリアする理由とエラーページを表示する方法。
protected void Application_Error(object sender, EventArgs e)
{
HttpContext ctx = HttpContext.Current;
Exception exception = ctx.Server.GetLastError();
string errorInfo =
"<br>Offending URL: " + ctx.Request.Url.ToString() +
"<br>Source: " + exception.Source +
"<br>Message: " + exception.Message +
"<br>Stack trace: " + exception.StackTrace;
ErrHandler.WriteError(errorInfo);
ctx.Server.ClearError();
}
<customErrors mode="On" defaultRedirect="Error.aspx"/>