I have an IIS 6 server running .net 4.0, that is returning 304 (Not Modified) for IE, but not for Firefox or Chrome. I never want this and other calls in the save .svc file to cache, but always to be 200 and new data. I’m not seeing this on localhost on Win7 that has IIS7.5 running.
The response header has a Cache-Content: private and when running under IIS 6, Fiddler doesn’t even show the request.
[OperationContract]
[WebGet(UriTemplate = "usertoken/populate")]
public ClientUserToken PopulateUserToken()
{
return HttpContext.Current.Session["userToken"] as UserToken;
}
I can add a [AspNetCacheProfile(“NoCachingProfile”)] to each method and
<outputCacheSettings>
<outputCacheProfiles>
<add name="NoCachingProfile" noStore="true" duration="0" varyByParam="none" enabled="false"/>
</outputCacheProfiles>
</outputCacheSettings>
to the web.config, but I’d like to avoid having to add this to every operation.
Is there an IIS setting to do this or should it be code driven? Why does it happen only in IE?
This is not the service’s problem, it is IE. Fiddler shows nothing because the browser didn’t send anything, it’s using the last cached response. Use Post if you can, otherwise make each Get request look different like:
url: "usertoken/populate?" + new Date().getTime()Older IE is bad with ignoring no-cache with Gets