Webforms 中的 Outputcaching VarietyByParams 是否理解路由参数?

发布于 2024-09-07 15:28:13 字数 176 浏览 1 评论 0原文

Webforms 中的输出缓存 VaryByParams 是否理解路由参数?这样,如果我有类似于 "Content/{filename}/{more}" 的路线,我可以执行 VaryByParams="filename" 并让它返回基于缓存的结果关于文件名并忽略 more 中的任何值?

Does outputcaching VaryByParams in webforms understand route parameters? Such that if I have a route similar to "Content/{filename}/{more}" that I could do VaryByParams="filename" and have it return cached results based on filename and ignore any values in the more?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凶凌 2024-09-14 15:28:13

VaryByParam 仅在 HTTP 方法为 GET 时使用查询字符串,在 HTTP 方法为 POST 时使用参数(即表单中的值和查询字符串)。除非您使用查询字符串进行路由,否则我认为它不会起作用。

请查看@OutputCache 的文档。

http://msdn.microsoft.com/en-us/library/hdxfb6cy。 aspx

也许您可以考虑在页面后面的代码中使用 C# 编写自己的缓存,而不是依赖 @OutputCache。

VaryByParam only work with query string when HTTP method is GET, and parameters (i.e. values in the form and query string) when HTTP method is POST. Unless you are using query string for routing I do not think that it will work.

Please take a look at the documentation of @OutputCache.

http://msdn.microsoft.com/en-us/library/hdxfb6cy.aspx

May be you can consider writing your own caching using C# in the code behind of the page instead of relying on @OutputCache.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文