Showing posts from March, 2016

Custom Error Messages in ASP.NET MVC

Even when you have custom errors mode on,
and Have all the custom error pages setup, like the following..

<customErrors mode="On" defaultRedirect="~/Error" redirectMode="ResponseRewrite"> <error statusCode="403" redirect="~/403" /> <error statusCode="401" redirect="~/401" /> <error statusCode="404" redirect="~/404" /> <error statusCode="409" redirect="~/409" /> <error statusCode="500" redirect="~/500" /> </customErrors>

You even set Response.TrySkipIisCustomErrors = true; on your error handler to get rid of those ugly IIS default error pages.
/// <summary> /// Returns a Not Found error. /// </summary> [HttpGet, Route("404")] [AllowAnonymous] public ActionResult NotFound() { Log.E…