I have custom errors enabled in my app. The web config has an entry as follows:
<customErrors mode="On" defaultRedirect="~/Views/Shared/Error.cshtml">
<error statusCode="403" redirect="~/Views/Shared/UnauthorizedAccess.cshtml"/>
<error statusCode="404" redirect="~/Views/Shared/FileNotFound.cshtml"/>
</customErrors>
I also have the HandleError
attribute applied as a global action filter. My FilterConfig
reads as follows:
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
Further, there is the default Error.cshtml
defined in the ~/Views/Shared
folder.
Yet, my application displays that ugly default error page of IE.
Update
I checked that the custom error pages are showing up fine in all other browsers except IE. What's the deal here?
Further Update
Just found this article. http://perishablepress.com/important-note-for-your-custom-error-pages/
It says that IE wants custom error pages to be at least 512 bytes in size. If your custom error page is less than that size, it'll throw up its own ugly error page.
Latest Update Everything works now that I've increased the payload of my error pages. However, only the default Error.cshtml page shows up for unhandled exceptions. For the other status codes, I get an ASP.NET 404 saying that it could not find my custom error page in the location I have specified in the web.config file. I do have the custom error pages and they have the exact names I have specified in the web.config.