HighTechTalks DotNet Forums  

ETag handling in IHttpHandler

ASP.net Caching microsoft.public.dotnet.framework.aspnet.caching


Discuss ETag handling in IHttpHandler in the ASP.net Caching forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
John H Clark
 
Posts: n/a

Default ETag handling in IHttpHandler - 06-29-2005 , 02:36 PM






I am attempting to manage all image GETs in a web site. To do this I am using
an IHttpHandler. All the basic functionality works well.

I am attempting to manage the caching of images on the client site using the
following snippet of code. The code attempts to set both "If-Modified-Since"
and "ETag" headers which will be used to determine whether the image needs to
be updated or not on any subsequent GET.

context.Response.Clear();
context.Response.ContentType = getContentType(context.Request.PhysicalPath);
context.Response.Cache.SetCacheability(HttpCacheab ility.Private)
context.Response.Cache.SetLastModified(getFileModi fiedDate(context.Request.PhysicalPath));
context.Response.Cache.VaryByHeaders["If-Modified-Since"] = true;
context.Response.Cache.SetETag(getFileETag(context .Request.PhysicalPath));
context.Response.Cache.VaryByHeaders["ETag"] = true;
context.Response.WriteFile(context.Request.Physica lPath);
context.Response.End();

On subsequent GETs the If-Modified-Since header appears with the
Last-Modified date properly set. However, the ETag header never appears. The
function getFileETag creates a valid ETag string.

Why is ETag not being set or requested by subsequent GETs?

Your help is appreciated.

--
John H Clark
www.weownit.coop

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.