How can I get If-Modified-Since and If-None-Match headers in IIS when using some sort of wildcard mapping? -
i have image server, takes urls of form
http://www.myserver.com/photo/foo/bar/baz/~120x120/crop/abc123.jpg
and dynamically generates thumbnails based on parameters parsed url string. we've had running in 2 configurations - 1 mapping 404 error in iis .aspx page, image processing in code-behind, , second implementing ihttphandler
, adding line system.web
section of /photo/web.config
so:
<httphandlers> <add verb="get,head" path="*" type="app_code.thumbnailhandler" /> </httphandlers>
i need add support http caching, in both configurations, iis silently stripping if-modified-since
, if-none-match
headers - fiddler shows browser sending them server, they're gone time page or handler gets access request.headers
collection.
how can write piece of code handles arbitrary, wildcard url requests, file extension, can still access headers need able respond 304 not modified
if client has current version of resource? next thing try rewriting mvc application seems overkill.
edit: ok, what's crazy if hit
http://www.myserver.com/photo/this/is/a/random/string/of/gibberish.aspx
(i.e. .aspx file extension) - headers intact! if hit
http://www.myserver.com/photo/this/is/a/random/string/of/gibberish.jpg
they're missing... ideas?
the workaround i've found implement ihttphandler described above, map every file extension you're 'matching' (in our case .jpg, .png , .tif) %windir%\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll in iis. that, bizarre reason, means iis invoke http handler without mangling headers first.
Comments
Post a Comment