相关疑难解决方法(0)

HandleError属性没有任何效果

在我的web.config中,我包括:

<customErrors mode="On" />
Run Code Online (Sandbox Code Playgroud)

现在黄色的死亡屏幕不再显示了.我以为我必须将HandleError属性包含在我的控制器方法或类本身中:

[HandleError]
public ActionResult About()
{
    throw new Exception("Just an exception");
    return View();
}
Run Code Online (Sandbox Code Playgroud)

但它没有任何影响,它是相同的:

public ActionResult About()
{
    throw new Exception("Just an exception");
    return View();
}
Run Code Online (Sandbox Code Playgroud)

在这两种情况下都会显示自定义错误页面.那么HandleError属性又是什么呢?

asp.net-mvc handleerror asp.net-mvc-3

7
推荐指数
2
解决办法
8014
查看次数

标签 统计

asp.net-mvc ×1

asp.net-mvc-3 ×1

handleerror ×1