Can someone explain why my custom error pages in MVC with windows authentication work when I access http://localhost:port/controler/blabla/blabla
, but when I try to access http://localhost:port/controler/action/blabla/blabla
, it doesn't invoke my custom 404 page but displays a blank window.
For example, when I call http://localhost:port/Home/blabla/blabla
, my custom page is called; but when I call http://localhost:port/Home/Index/blabla/blabla
(the same URL with action added), it shows the blank page. Is it something with my configuration?
My config:
<customErrors mode="On" defaultRedirect="~/UnAuthorized/ErrorDefault/?error=1">
<error statusCode="404" redirect="~/UnAuthorized/ErrorResourceNotFound/?error=1"/>
<error statusCode="403" redirect="~/UnAuthorized/ErrorResourceNotFound/?error=1"/>
<error statusCode="500" redirect="~/UnAuthorized/ErrorDefault/?error=1"/>
</customErrors>
<httpErrors errorMode="Custom">
<remove statusCode="404" subStatusCode="-1"/>
<remove statusCode="403" subStatusCode="-1"/>
<remove statusCode="500" subStatusCode="-1"/>
<error statusCode="404" subStatusCode="-1" prefixLanguageFilePath="" path="~/UnAuthorized/ErrorResourceNotFound/?error=1" responseMode="ExecuteURL" />
<error statusCode="403" subStatusCode="-1" path="~/UnAuthorized/ErrorResourceNotFound/?error=1" responseMode="ExecuteURL" />
<error statusCode="500" subStatusCode="-1" path="~/UnAuthorized/TestPage" responseMode="ExecuteURL" />
</httpErrors>