سؤال

In my scenario, I have an aspx page which has links to some .js files.

What I have observed is that, some times my browser returns a 200 response even though I have added the following settings in my web.config

<customHeaders>
    <clear />
    <add name="Expires" value="Sun, 07 Apr 2047 00:00:00 GMT" />
    <add name="Cache-Control" value="max-age=5"/>
</customHeaders>

As far as my understanding goes, unless there is a change in Etags the file should be retrieved from the cache and thus return a 200 response.

In my 200 response headers

Last-Modified = Thu, 23 Feb 2012 10:02:49 GMT

Etag = "82f46e4c12f2cc1:0"

In my request Headers

If-Modified-Since = Thu, 23 Feb 2012 10:02:49 GMT

If-None-Match = "80aa474c12f2cc1:0"

I know that

If-None-Match != Etag

Then we should get a 200 response. Ideally if the Etags are generated from the Lastmodified date only, then it should not change no matter what. But as you can also see, it gets changed automatically. This means that Etags have a tendency to change.

Question: How do we control this modification? Especially through the web.config.

هل كانت مفيدة؟

المحلول

ETAG_CHANGENUMBER is the key which contributes to the generation of Etags. This is not configurable is IIS7 but is configurable in IIS6 see this - http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/ef7f9d58-2a96-4bd8-8ac1-2a67b43284f1.mspx?mfr=true

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top