Caching Question

J

Jeff Meyer

My question basically pertains to how the client-side caching of
dynamically-created content works in an environment consisting of an IIS web
server and an IE browser client.

For example, in a certain page assume I have the following image tag:

<img src="dynamic.image.aspx?guid_image=<guid for image>" />

and the dynamic.image.aspx page determines the bits to stream back as a
valid image. I have the following questions:

-- Would this content ever be cached on the client?
-- If it is cached, what determines when the cache is overwritten?
-- Is there are any way to make the caching dependent on the content
returned by dynamic.image.aspx, assuming this is not the default case?

I have been searching for documentation on issues like this and generally
information about how caching works in an MS IE/IIS environment without a
lot of luck; if anyone can provide links to help me out or answers to the
above questions, I'd appreciate it.

Thanks!
Jeff Meyer
Senior Software Engineer
IncuBIT, LLC
 
D

David Wang [Msft]

To be certain, there is nothing MS/IIS/proprietary about caching -- we're
talking about HTTP Clients and Servers, so you should read RFC2616 on
w3c.org on how HTTP client/servers are supposed to interact with respect to
caching. This is why you see no Microsoft documentation about it...

Since you are doing something custom (dynamically generate images given the
same URL), you will likely have to know more about what the HTTP spec says
about Caching to determine how your code can best take advantage of it.
Realize that ASP.Net cannot read your mind and determine the most optimal
(yet correct) response strategy in all cases -- most common situations can
be optimized, but some custom situations may require manual intervention for
best results.

I suggest you read RFC2616 and understand how the following headers work:
ETag
If-Match
If-Modified-Since

HTTP Browsers should do the right thing if the web app does the right thing.


In general, realize the following:
1. Server-side caching usually depends on the URL (or other
simple-to-calculate value) since it makes no sense for the server to
calculate a hash of every response to determine if it is "different" or not.
This means that dynamic image generation has potential to break all sorts of
rules and may not make any sense to cache because it is too hard to figure
out what is cacheable/revokable. In particular, if one URL+QueryString can
result in >1 image data, that is bad news in general.
2. Client-side caching is all focused on not making a download of the
resource unless it has to. Thus, ETag provides a convenient quick hash for
the client to use to ask the server "did you already send this to me?"
If-Modified-Since allows the client to ask the server "is your resource
newer than mine?"

--
//David
IIS
http://blogs.msdn.com/David.Wang
This posting is provided "AS IS" with no warranties, and confers no rights.
//
My question basically pertains to how the client-side caching of
dynamically-created content works in an environment consisting of an IIS web
server and an IE browser client.

For example, in a certain page assume I have the following image tag:

<img src="dynamic.image.aspx?guid_image=<guid for image>" />

and the dynamic.image.aspx page determines the bits to stream back as a
valid image. I have the following questions:

-- Would this content ever be cached on the client?
-- If it is cached, what determines when the cache is overwritten?
-- Is there are any way to make the caching dependent on the content
returned by dynamic.image.aspx, assuming this is not the default case?

I have been searching for documentation on issues like this and generally
information about how caching works in an MS IE/IIS environment without a
lot of luck; if anyone can provide links to help me out or answers to the
above questions, I'd appreciate it.

Thanks!
Jeff Meyer
Senior Software Engineer
IncuBIT, LLC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top