IIS7 ASP.NET MVC 2 Asset Caching Module Not Working?

If you're running in Integrated Pipeline mode in IIS7, HTTP modules go under.

Up vote 2 down vote favorite 1 share g+ share fb share tw.

I have this HttpModule that I am using to remove unwanted headers and cache assets for about 30 days but it does not seem to work. Code and http response below: Response: Cache-Control private Content-Type text/html; charset=utf-8 Content-Encoding gzip Vary Accept-Encoding Server Microsoft-IIS/7.5 X-AspNetMvc-Version 2.0 X-AspNet-Version 4.0.30319 X-Powered-By ASP. NET Date Sat, 13 Nov 2010 20:13:57 GMT Content-Length 1892 Code: public class AssetCacheModule : IHttpModule { private static readonly List _headersToRemove = new List { "X-AspNet-Version", "X-AspNetMvc-Version", "Etag", "Server", }; private static readonly List _longCacheExtensions = new List {".

Js", ". Css", ". Png", ".

Jpg", ". Gif",}; public void Init(HttpApplication context) { context. EndRequest += ContextEndRequest; } private static void ContextEndRequest(object sender, EventArgs e) { var context = HttpContext.

Current; _headersToRemove. ForEach(h => context.Response.Headers. Remove(h)); var extension = Path.

GetExtension(context.Request.Url. AbsolutePath); if (_longCacheExtensions. Contains(extension)) { TimeSpan cacheDuration = TimeSpan.

FromSeconds(44000); context.Response.Cache. SetCacheability(HttpCacheability. Public); context.Response.Cache.

SetExpires(DateTime.Now. Add(cacheDuration)); context.Response.Cache. SetMaxAge(cacheDuration); context.Response.Cache.

AppendCacheExtension("must-revalidate, proxy-revalidate"); } } public void Dispose() { } } web. Config: What am I missing? C# asp.

Net-mvc-2 caching iis7 etag link|improve this question asked Nov 13 '10 at 20:19Paul3,2051818 89% accept rate.

So simple, should have known that! Thanks for taking the time to answer my question. – Paul Nov 15 '10 at 20:08.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions


Thank You!
send