如何在 ASP.NET 中设置多个缓存控制指令
我必须在 ASP.NET 页面上设置几个特定的缓存控制指令才能通过 Hailstorm 安全扫描。例如,
Cache-control: no-cache="set-cookie"
之外
Cache-control: no-cache
除了我在 C# 代码隐藏中使用以下行设置后者
Response.CacheControl = "no-cache";
,它还希望我拥有:是否有一种特殊的方法可以同时指示两个指令?我只是用分号分隔它们吗?
I have to have several certain cache-control directives set on an ASP.NET page in order to pass a Hailstorm security scan. For example, it wants me to have
Cache-control: no-cache="set-cookie"
in addition to
Cache-control: no-cache
I have been setting the latter with the following line in my C# codebehind:
Response.CacheControl = "no-cache";
Is there a special way to indicate both directives at once? Do I just separate them with a semicolon?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在 OnInit 事件中执行此操作,如下所示:
为此目的创建 HttpModule 也许是个好主意。
You can do this in the OnInit event like this:
Maybe a good idea to create HttpModule for this purpose.