When I debug my asp.net mvc 2 application and I put a break point on my action that is called when a 404 error occurs every time I invoke any action my error action gets called but the view does not get displayed.
This is in my web.config (copied from nerddinner):
<customErrors mode="RemoteOnly" defaultRedirect="/Home/Trouble"&g开发者_运维百科t;
<error statusCode="404" redirect="/Home/Confused" />
</customErrors>
Nerd Dinner doesn't do this and as soon as I take off Ninject mine doesn't do it either.
Any advice?
This works for me with Ninject and MVC2.
<customErrors mode="Off" defaultRedirect="Error.htm" redirectMode="ResponseRedirect">
<error statusCode="403" redirect="Error.htm"/>
<error statusCode="404" redirect="Error.htm"/>
</customErrors>
Try adding redirectMode="ResponseRedirect" to your customErrors tag.
精彩评论