how to handle 400 bad request like stackoverflow in mvc 3 , iis 6 ?
eg: http://www.stackoverflow.com/a<
return 404 not found page , instead of a YSOD page
updated: why this does not work ?
<httpErrors errorMode="Detailed">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" subStatusCode="-1" path="/notfound" responseMode="ExecuteURL" />
<error statusCode="400" subStatusCode="-1" path="/Error" responseMode="ExecuteURL" />
</httpErrors>
Use customErrors tag of web.config:
Eg.:
if UrlToRedirect = “~/Error/Index”, Here, in this url, “Error” is the name of controller & “Index” is the name of Action method which returns Error View Page.
In the “\Views\Shared Folder” of you application, you have “Error.cshtml” view page.