I do some Caching-Checks (etag) in my base controller called "CachingController"
public CachingController:Controller {
public CachingController() {
if (IsKnownEtag(Request.Headers["If-None-Match"])) {
Response.StatusCode=304;
}
}
}
public MyController:CachingController {
public ActionResult IsMagic(string dragonName) {
var isMagic=dragonName=="Puff";
// ...
SaveEtag();
return new ActionResult(isMagic);
}
}
So in the Constructor of my Base Controller I check if the Etag is valid. If it is, I want to return the status code. After I set the Status code I do not want that the Controller Action is still called. How can I do this without modifying each Action?