Asp.net mvc 我能让uesr';浏览器是否将缓存MVC3页面?

Asp.net mvc 我能让uesr';浏览器是否将缓存MVC3页面?,asp.net-mvc,Asp.net Mvc,我的页面每周都保持不变。每次用户请求它们时,它们都会重新生成 我已为静态设置了以下内容: <system.webServer> <staticContent> <clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00" /> </staticContent> </s

我的页面每周都保持不变。每次用户请求它们时,它们都会重新生成

我已为静态设置了以下内容:

  <system.webServer>
    <staticContent>
      <clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00" />
    </staticContent>
  </system.webServer>


我可以做些什么来让动态页面也缓存吗?

这不是在页面(视图)上设置的,而是在您的操作上设置的。
您可以使用以下方法:

public class HomeController : Controller
{
    [OutputCache(Duration=10, VaryByParam="none")]
    public ActionResult Index()
    {
        return View();
    }

}

这不是在您的页面(视图)上设置的,而是在您的操作上设置的。
您可以使用以下方法:

public class HomeController : Controller
{
    [OutputCache(Duration=10, VaryByParam="none")]
    public ActionResult Index()
    {
        return View();
    }

}