How to return a view for HttpNotFound() in ASP.Net MVC 3? -
is there way return same view every time httpnotfoundresult returned controller? how specify view? i'm guessing configuring 404 page in web.config might work, wanted know if there better way handle result.
edit / follow up:
i ended using solution found in second answer question slight tweaks asp.net mvc 3 handle 404s: how can handle 404s in asp.net mvc?
httpnotfoundresult
doesn't render view. sets status code 404 , returns empty result useful things ajax if want custom 404 error page throw new httpexception(404, "not found")
automatically render configured view in web.config:
<customerrors mode="remoteonly" redirectmode="responserewrite"> <error statuscode="404" redirect="/http404.html" /> </customerrors>
Comments
Post a Comment