asp.net mvc - SetLastModified ignored when using an OutputCacheAttribute -


i've got asp.net mvc method (v3.0 on .net 4.0) set following:

[outputcache(duration = 31536000, location = outputcachelocation.any)] public virtual actionresult item() {     this.response.cache.setlastmodified(new datetime(2011, 01, 01));     return this.content("hello world", "text/plain"); } 

i'd expect come last-modified header set mon, 07 feb 2011 00:00:00 gmt specified, coming date output first cached in output cache (i.e. first time method called since iis reset).

if comment out [outputcache] attribute no output caching done last-modified header comes expected, appears it's in output caching infrastructure that's choosing ignore specified value this.

any idea why might doing so? , there way make use specified value last-modified date?

well, never did work out reason occurs, looks bug somewhere in asp.net page caching infrastructure [outputcache] attribute uses.

i ended writing custom [httpcache] attribute same public interface, calls appropriate cache methods on response.cache object directly rather delegating asp.net page caching infrastructure.

that works fine. it's shame built-in attribute doesn't.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -