仅为匿名用户缓存ASP.NET页 [英] Cache ASP.NET page for anonymous users only

查看:71
本文介绍了仅为匿名用户缓存ASP.NET页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种简单的方法可以仅针对匿名用户(使用表单身份验证)缓存ASP.NET整个页面?

Is there an easy way to cache ASP.NET whole page for anonymous users only (forms authentication used)?

上下文:我正在创建一个网站,其中向匿名用户显示的页面基本上是完全静态的,但为已登录用户显示的页面却不是完全静态的.

Context: I'm making a website where pages displayed to anonymous users are mostly completely static, but the same pages displayed for logged-in users are not.

我当然可以通过后面的代码手动完成此操作,但是我认为可能会有更好/更容易/更快的方法.

Of course I can do this by hand through code behind, but I thought there might be a better/easier/faster way.

推荐答案

您可以使用VaryByCustom,并使用username这样的键.

You could use VaryByCustom, and use a key like username.

这篇关于仅为匿名用户缓存ASP.NET页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆