gpt4 book ai didi

asp.net-mvc - Razor View 引擎 .cshtml 页面中的 OutputCache

转载 作者:行者123 更新时间:2023-12-04 10:44:47 25 4
gpt4 key购买 nike

使用 ASP.NET MVC Web 表单,我们可以将输出缓存放在 Controller 级别或 View 级别。我们如何在 .cshtml 页面中提及“outputcache”?

我没有在任何地方找到它。我在哪里可以获得语法?

最佳答案

你是什​​么意思“ASP.NET MVC Web 窗体”?如果您指的是 OutputCache Page 指令中的属性,即 ASP.NET Web 窗体。

ASP.NET MVC 在 Controller 操作级别具有输出缓存:

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

这与 View 引擎 (ASPX/Razor) 无关。

关于asp.net-mvc - Razor View 引擎 .cshtml 页面中的 OutputCache,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4415540/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com