I have an IHttpHandler similar to AssemblyResourceLoader. What it does is generate an image and then send it back to the browser.
In AssemblyResourceLoader there is a code block like this:
HttpCachePolicy cache = context.Response.Cache;
cache.SetCacheability(HttpCacheability.Public);
cache.VaryByParams["d"] = true;
cache.SetOmitVaryStar(true);
cache.SetExpires(DateTime.Now + TimeSpan.FromDays(365.0));
cache.SetValidUntilExpires(true);
Pair assemblyInfo = GetAssemblyInfo(assembly);
cache.SetLastModified(new DateTime((long) assemblyInfo.Second));
I have set up mine to emit the exact same headers as AssemblyResourceLoader. I set the Last-Modified header and the browser sends the If-Modified-Since header to my handler just as it does with AssemblyResourceLoader. The problem is this: My handler never returns the 304 like AssemblyResourceLoader does. I can't find anywhere in the AssemblyResourceLoader code where it deals with the If-Modified-Since header so I don't know how to deal with it myself. Does anybody know where ASP.Net does that and how I can get the same behavior out of my handler?
Thanks.