ASP.NET MVC HandleError View Not Found

六眼飞鱼酱① 提交于 2019-12-04 17:06:49

If you put your errors subfolder inside of the shared folder, you can refer to it by Errors/whatevererror.aspx and it should be fine.

I do this frequently. After all they are shared views. :)

AFAIK you cannot modify the location of those views. They should be in ~/Views/Shared. You could specify the name though per exception type:

[HandleError(
    Order = 1, 
    ExceptionType = typeof(SocketsOfflineException), 
    View = "EndSystemDownError"
)]

where the EndSystemDownError view is located in ~/Views/Shared/EndSystemDownError.aspx.

did you try

[HandleError(Order = 1, ExceptionType = typeof(SocketsOfflineException), View="Error/EndSystemDownError")]

Side note for Orchard module programming:

The HandleError attribute won't work in Orchard modules as Orchard implements a custom filter handling itself.

You need to implement a FilterProvider that overrides the OnResultExecuted() to catch exceptions thrown in a view.

See src\Orchard\Exceptions\Filters\UnhandledExceptionFilter.cs, it implements the common Orchard error page.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!