开发者

How does one set multiple cache-control directives in ASP.NET

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 开发者_Go百科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?


You can do this in the OnInit event like this:

  protected override void OnInit(EventArgs e)
        {
            Response.CacheControl = "no-cache"; 

            base.OnInit(e);
        }

Maybe a good idea to create HttpModule for this purpose.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜