how do I remove exception / result 404 or FileNotFound from my action and let IIS use my customErrors configuration configuration to show page 404?
I defined my custom errors as such
<customErrors mode="On" defaultRedirect="/trouble"> <error statusCode="404" redirect="/notfound" /> </customErrors>
My first attempt at actionResult that tries to add this does not work.
public class NotFoundResult : ActionResult { public NotFoundResult() { } public override void ExecuteResult(ControllerContext context) { context.HttpContext.Response.TrySkipIisCustomErrors = false; context.HttpContext.Response.StatusCode = 404; } }
But it just shows a blank page, not my / not found page
: (
What should I do?
CVertex Jan 04 '10 at 8:58
source share