开发者

ASP.NET MVC Error Handling - View never renders, Web.config problem?

I have a [HandleError] attribute specified atop one of my controllers, specifying a View that I'd like to render in the event of an error.

I also have the following config section in my web.confi开发者_JS百科g:

<customErrors mode="On">
      <error statusCode="404" redirect="~/Error/NotFound"/>
      <error statusCode="500" redirect="~/Error/Unknown"/>
    </customErrors>

No matter what happens, mvc renders the view in the customErrors section. I cannot override the View for some reason.

Also, I've lost all contextual information by the time the view renders.

Not sure what I'm doing wrong or if someone else has experienced this problem.

ps: I've also confirmed the Views that I'm trying to redirect to don't have any errors in them. Very frusterating problem!


Sorry, my fault.

Turns out there was an error in the view itself which was resulting in a redirect to the customErrors url.

Doh!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜