User-173651909 posted
I need to configure custom error pages (404/511 etc) in my MVC app running in Azure. Currently I have a directory in the root of the project containing the custom views (~/Errors/404.cshtml) and below is the code I'm using which I've got from various articles.
<system.webServer>
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="400" subStatusCode="-1" />
<error statusCode="400" responseMode="ExecuteURL" path="~/Errors/400.cshtml" />
<remove statusCode="401" subStatusCode="-1" />
<error statusCode="401" responseMode="ExecuteURL" path="~/Errors/401.cshtml" />
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" responseMode="ExecuteURL" path="~/Errors/404.cshtml" />
<remove statusCode="500" subStatusCode="-1" />
<error statusCode="500" responseMode="ExecuteURL" path="~/Errors/500.cshtml" />
<remove statusCode="503" subStatusCode="-1" />
<error statusCode="503" responseMode="ExecuteURL" path="~/Errors/503.cshtml" />
<remove statusCode="508" subStatusCode="-1" />
<error statusCode="508" responseMode="ExecuteURL" path="~/Errors/508.cshtml" />
<remove statusCode="511" subStatusCode="-1" />
<error statusCode="511" responseMode="ExecuteURL" path="~/Errors/511.cshtml" />
</httpErrors>
</system.webServer>
Any ideas as to why it's not picking up the pages? If I try to simulate a 404 by entering an non-existant url (for example www.mywebsite.com/fsdnkjsndfk) then it displays a blank page.
Thanks in advance
Adam