Can I force MVC to get a new page?

2019-06-13 19:37发布

问题:

I am using code like this:

[OutputCache(Duration = 86400, VaryByParam = "none")] 
public ActionResult Index() {
}

Everything works well BUT there are times when I would like to force MVC to get a new page when I do a redirect to the index page using:

RedirectToAction("index", "home");

Is this possible? Is there some way that I can invalidate the cache?

回答1:

You could try something like:

HttpResponse.RemoveOutputCacheItem("/Home");