开发者

how to add an Expires or a Cache-Control Header programmatic in #asp.net?

开发者_运维百科i host my web site into a shared hosting and i need to set expiration header using iis but i didn't find my hosting allow this feature so , is there any way to set it into my web configuration or into my code ??


Google is your friend :)

MSDN Article: HttpResponse.AddHeader Method

You can also use HttpResponse.AppendHeader, which is semantically the same as HttpResponse.AddHeader.

Good Luck.


You can use this code in Page_Load

Response.Headers.Add("Expires", "ddd, dd m YYYY hh:mm:ss GMT");

You have to change the date for yours

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜