1 2 3 4 5 6 7 | < customerrors defaultredirect = "/Error/401" mode = "On" > < error redirect = "/Error/401" statuscode = "401" > < error redirect = "/Error/404" statuscode = "404" > </ error ></ error ></ customerrors > |
as you can see from MSDN,
there is a configuration setting from IIS instead of asp.net router to handle all http error for all request
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | < system.webServer > < httpErrors errorMode = "Custom" > < remove statusCode = "401" subStatusCode = '-1' /> < remove statusCode = "404" subStatusCode = '-1' /> < remove statusCode = "500" subStatusCode = '-1' /> < error path = "/error/404" prefixlanguagefilepath = "" responsemode = "ExecuteURL" statuscode = "403" > < error path = "/error/404" prefixlanguagefilepath = "" responsemode = "ExecuteURL" statuscode = "404" > < error path = "/error/500" prefixlanguagefilepath = "" responsemode = "ExecuteURL" statuscode = "500" > </ httpErrors > </ system.webServer ></ error ></ error ></ error > |