使用 Substitution 控件时忽略 Asp.Net OutputCache 指令

发布于 2024-12-25 17:14:14 字数 335 浏览 3 评论 0原文

我有一个显示登录用户名的主页。内容页 (default.aspx) 使用此母版并具有 OutputCache 指令。

缓存按照宣传的方式工作,除了当我将替换控件添加到母版页时,所有缓存都会停止,每次刷新都会得到一个新页面。 Substitution 控件将正确的用户名插入到页面中,因此它被调用。但其中的某些东西似乎正在杀死缓存。返回用户名的代码只是返回一个固定字符串,而我正在测试以确保没有副作用。

如果我不使用替换控件,页面会被缓存,但对所有用户显示的用户名也会被缓存)。

是否支持此场景(母版页未缓存,母版页上的替换控制,内容页已缓存)?

有任何故障排除提示可以了解是什么使缓存无效吗?

I have a master page that shows the logged in user name. The content page (default.aspx) uses this master and has an OutputCache directive.

The cache works as advertised except for when I add the Substitution control to the master page at which point, all caching stops and I get a fresh page each refresh. The Substitution control inserts the correct username into the page, so it is getting called. But something in there seems to be killing off the cache. The code for returning the user name simply returns a fixed string while I am testing to ensure no side effects.

If I don't use the substitution control the page gets cached, but so does the username which is shown the same to all users).

Is this scenario supported (master page is not cached, Substitution control on master,content page is cached)?

Any troubleshooting hints to see what is invalidating the cache?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文