Reputation: 121
I am facing a starnge issue with one of my server, I've setup the custom error pages however error pages are not showing up when I have file extension in URL for example it does not work for somedomain.com/abcd.aspx or somedomain.com/abcd.aspx, it just show me blank page.
It is working if I dont have file extension in my URL for example http://somedomain.com/abcd works fine.
Following is the configuration setting in web.config file
<httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL" existingResponse="Replace">
<remove statusCode="502" subStatusCode="-1" />
<remove statusCode="501" subStatusCode="-1" />
<remove statusCode="500" subStatusCode="-1" />
<remove statusCode="412" subStatusCode="-1" />
<remove statusCode="406" subStatusCode="-1" />
<remove statusCode="405" subStatusCode="-1" />
<remove statusCode="404" subStatusCode="-1" />
<remove statusCode="403" subStatusCode="-1" />
<remove statusCode="401" subStatusCode="-1" />
<error statusCode="401" prefixLanguageFilePath="" path="/Error/Error400.aspx" responseMode="ExecuteURL" />
<error statusCode="403" prefixLanguageFilePath="" path="/Error/Error400.aspx" responseMode="ExecuteURL" />
<error statusCode="404" prefixLanguageFilePath="" path="/Error/Error400.aspx" responseMode="ExecuteURL" />
<error statusCode="405" prefixLanguageFilePath="" path="/Error/Error400.aspx" responseMode="ExecuteURL" />
<error statusCode="406" prefixLanguageFilePath="" path="/Error/Error400.aspx" responseMode="ExecuteURL" />
<error statusCode="412" prefixLanguageFilePath="" path="/Error/Error400.aspx" responseMode="ExecuteURL" />
<error statusCode="500" prefixLanguageFilePath="" path="/Error/Error500.aspx" responseMode="ExecuteURL" />
<error statusCode="501" prefixLanguageFilePath="" path="/Error/Error500.aspx" responseMode="ExecuteURL" />
<error statusCode="502" prefixLanguageFilePath="" path="/Error/Error500.aspx" responseMode="ExecuteURL" />
</httpErrors>
Any help or pointers will be great.
Regards, Sameer
Upvotes: 1
Views: 3538
Reputation: 11
I'm sure you've already solved this by now, but for others searching for the answer, I ran into this same issue today and was able to solve it by adding a customError handler in addition to the httpErrors.
Change:
<system.web>
<customErrors mode="Off" />
to:
<system.web>
<customErrors mode="RemoteOnly">
<error redirect="/Errors/404" statusCode="404" />
</customErrors>
Upvotes: 1