Shared error view in ASP.Net MVC 3, what's it for?
I'm still new to MVC 3 and I'm struggling to create a nice error page for my application.
I've noticed the shared Error.cshtml view which is auto generated, what's it used for and how ?
Any links to implementing a simple single error page would be brilliant as well :-开发者_运维技巧)
That is already in place; you just aren't seeing it as by default raw errors are displayed if your request comes from the web-server itself - very useful for debugging. Remote visitors would see the default error.cshtml result:
Sorry, an error occurred while processing your request.
To see the error page even when local, ensure the customErrors mode is "On":
<customErrors mode="On"/>
You may need to add this to <system.web>
in web.config. But most commonly during debugging this is set to "RemoteOnly".
精彩评论