[RESOLVED]How to make custom ErrorPages in MVC5

Edit: Never mind, helps to being the right project of the solution when doing this.

I would like to serve up a customer 404 and 500 error page and tried following
http://benfoster.io/blog/aspnet-mvc-custom-error-pages but I still get the default error pages when I test them out in VS debugger. What do I have to do to get this working?

    <system.webServer>
        <httpErrors>
            <remove statusCode="404" />
            <error statusCode="404" path="404.html" responseMode="File" />
            <remove statusCode="500" />
            <error statusCode="500" path="500.html" responseMode="File" />
        </httpErrors>
    </system.webServer>

    <system.web>
        <compilation debug="true" targetFramework="4.5.1" />
        
        <customErrors mode="On" redirectMode="ResponseRewrite">
            <error statusCode="404" redirect="~/404.aspx" />
            <error statusCode="500" redirect="~/500.aspx" />
        </customErrors>
        
        <httpRuntime targetFramework="4.5.1" />
    </system.web>

I have managed to write up a small article on this.Hope this could help you.

http://www.codeproject.com/Tips/828325/Custom-Errors-in-ASP-NET

Thanks.

Leave a Reply