asp.net mvc 3 - IIS 7.5 not taking notice of customErrors for 404 returned by MVC 3 app -
i'm running mvc 3 app (recently updated 2) on iis 7.5 (win 7 64bit) .net 4.0 integrated pipeline app pool , have following set-up in web.config:
<customerrors mode="on" defaultredirect="~/problem/oops" redirectmode="responseredirect"> <error statuscode="404" redirect="~/problem/notfound" /> </customerrors>
if action method on controller throws exception server , hence generates 500 errorcode correctly sends browser default redirect url.
however if action deliberately returns httpnotfoundresult via httpnotfound() iis 7.5 404.0 error page , not 1 indicated in web.config.
if enter url doesn't exist on app http://localhost/myapp/foo shown page indicated web.config.
anybody have ideas why i'm not getting redirected custom 404 error page when using httpnotfound()?
please try below syntax instead of calling httpnotfound , let me know result ;)
throw new httpexception(404, "notfound");
Comments
Post a Comment