Base solution for your next web application
Open Closed

Error Page Does Not Show Automatically #1773


User avatar
0
alcjamabp created

I'm running abp on localhost but the error page does not show up when i throw an exception. I already set the customErrors to "On" in the web config. I also tried to set the defaulRedirectAttribute like so:

<customErrors mode="On" defaultRedirect="~/Views/Shared/Error.cshtml" />

also tried this (assuming there is some hidden Error controller somewhere):

<customErrors mode="On" defaultRedirect="~/Views/Shared/Error" />

Are we suppose to build an error controller for this? If so then the documentation is wrong in claiming that it is automatically shown.

[http://aspnetboilerplate.com/Pages/Documents/Handling-Exceptions])


1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    I'm assuming you are using ASP.NET MVC 5.x (not Core).

    Startup template already contains Shared/Error.cshtml (<a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate-templates/blob/master/src/AbpCompanyName.AbpProjectName.WebMpa/Views/Shared/Error.cshtml">https://github.com/aspnetboilerplate/as ... ror.cshtml</a>). To test it;

    • I downloaded a new template from <a class="postlink" href="http://www.aspnetboilerplate.com/Templates">http://www.aspnetboilerplate.com/Templates</a> (asp.net mvc 5.x, MPA, EF, not include module zero)
    • I added throw new UserFriendlyException("This is a test exception!"); to HomeController.Index
    • I run the application and see the error page.

    How can I reproduce the problem you have?