MVC Error Handling

I have an MVC project with three areas. In the main project, I have error handling installed using user errors in the web.config file.

<customErrors mode="On" defaultRedirect="~/Error/HttpError"> <error statusCode="404" redirect="~/Error/Http404" /> </customErrors> 

This causes the site to be redirected to the error controller in the root directory, and then displays a representation of the error.

This works fine on the root site, however, when I make an exception in the home controller of one area of ​​the site this message is lower.

Runtime Error Description. Application error on server. The current user error settings for this application do not allow viewing error information about the application.

Details To allow viewing of this particular error message on the local server, create a tag in the configuration file "web.config" located in the root directory of the current web application. This tag must have the "mode" attribute set to "RemoteOnly". To allow viewing of parts on remote computers, set the "mode" to "Off."

Is it possible that error handling on the root site cannot be used on sites?

thanks

John.

+6
asp.net-mvc asp.net-mvc-areas
source share
1 answer

Does the area have its own web.config that can set its own error handling methods? Can you put a breakpoint in Application_OnError to see if another error occurred (for example, loading one error page β€” for example, if you turned off buffering, it won’t be able to redirect)?

You can also try adding something like this to the main web.config to find out it doesn't matter:

 <location path="nameOfArea"> <system.web> <customErrors mode="On" defaultRedirect="~/Error/HttpError" /> </system.web> </location> 
+1
source share

All Articles