1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
To enable custom errors in ASP.NET MVC application we need (IIS 7+): Configure custom pages in web config under system.web section: <customErrors mode="RemoteOnly" defaultRedirect="~/error"> <error statusCode="404" redirect="~/error/kutayzorlu404" /> <error statusCode="500" redirect="~/error" /> </customErrors> HttpContext.Current.Response.StatusCode = 500; HttpContext.Current.Response.TrySkipIisCustomErrors = true; <httpErrors errorMode="Detailed" /> |