MVC3 HttpStatusCodeResult Not working in OnActionExecuted
I have the following code which uses the new MVC3 HttpStatusCodeResult:
protected override void OnActionExecuted(ActionExec开发者_开发百科utedContext filterContext) {
base.OnActionExecuted(filterContext);
filterContext.Result = new HttpStatusCodeResult(304, "Not Modified");
}
I am still getting a 200OK and I can't figure out why. Please advise.
Works for me:
public class HomeController : Controller
{
protected override void OnActionExecuted(ActionExecutedContext filterContext)
{
base.OnActionExecuted(filterContext);
filterContext.Result = new HttpStatusCodeResult(304, "Not Modified");
}
public ActionResult Index()
{
return View();
}
}
And the result is what we would expect:
精彩评论