WebResource.axd and HTTP Headers

て烟熏妆下的殇ゞ 提交于 2019-12-04 16:19:53

You could try:

HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.Public);

The other types of HttpCacheability are documented here:

http://msdn.microsoft.com/en-us/library/system.web.httpcacheability.aspx

Edit:

You can throw this in your Global.asax file instead of a module:

void Application_AuthorizeRequest(object sender, EventArgs e)
{
    if (Request.Path.IndexOf("WebResource.axd") > -1)
    {
        Response.Cache.SetCacheability(HttpCacheability.Public);
    }
}
Atanas Korchev

This may occur if your web site is deployed with <compilation debug="true"> set in its web.config. Caching is disabled in this case for easier debugging of JavaScript files served as embedded resources. The solution is to simply set the debug attribute of the compilation tag to false. More info can be found in this excellent blog post.

Thanks for your responses. It turned out we already had the HttpModule that I didn't want to write in place, and it was the source of the problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!