1
我在post(@Ivan Zlatev答案)的幫助下實施了ELMAH。它工作正常。但是現在我需要用錯誤信息重定向默認錯誤頁面。ELMAH實施後如何重定向到默認錯誤頁面?
我該怎麼做?我正在閱讀ELMAH,我們無法實現自定義錯誤頁面。這是真的嗎?
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new ElmahHandledErrorLoggerFilter());
filters.Add(new HandleErrorAttribute());
}
public class ElmahHandledErrorLoggerFilter : IExceptionFilter
{
public void OnException(ExceptionContext context)
{
// Log only handled exceptions, because all other will be caught by ELMAH anyway.
if (context.ExceptionHandled)
ErrorSignal.FromCurrentContext().Raise(context.Exception);
}
}