eth*_*th0 21 c# asp.net asp.net-mvc-4 bundling-and-minification asp.net-optimization
我想更改从捆绑请求发送的缓存标头.目前它是变化的,User-Agent但我不希望它,有没有办法更改捆绑请求发送的标头?
快速查看System.Web.Optimization程序集后,我可以看到标题设置在Bundle.SetHeaders一个私有静态函数中,所以我认为它不可能,尽管我希望被证明是错误的.
Hao*_*ung 11
这不是我们目前公开的内容.我们只在BundleResponse上暴露了IBundleTransform可能改变的Cacheability属性.是的,我们明确地设置了以下内容:
HttpCachePolicyBase cachePolicy = context.HttpContext.Response.Cache;
cachePolicy.SetCacheability(bundleResponse.Cacheability);
cachePolicy.SetOmitVaryStar(true);
cachePolicy.SetExpires(DateTime.Now.AddYears(1));
cachePolicy.SetValidUntilExpires(true);
cachePolicy.SetLastModified(DateTime.Now);
cachePolicy.VaryByHeaders["User-Agent"] = true;
Run Code Online (Sandbox Code Playgroud)
我们有一个工作项目我们的积压工具打开它,并使其在未来更具可扩展性/可定制性.
| 归档时间: |
|
| 查看次数: |
5334 次 |
| 最近记录: |