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);
}
}