I am trying to set the lastmodified date/etag in the Web API response.
response.Headers.ETag = new EntityTagHeaderValue("\"1\"");
response.Content.Headers.LastModified = DateTime.Now.AddDays(-1);
return response;
However, it is not working if I host that IIS, but if I tried to debug that and hit the api host by visual studio vs2012 (when I try to debug), I am getting the value back.
Anyone has any suggestion on that? I think it has something to do with the configuration on IIS, but I cannot figure that out.
Response header while hitting API hosting from IIS7.5
Cache-Control →no-cache
Content-Length →2399
Content-Type →application/json; charset=utf-8
Date →Thu, 19 Dec 2013 07:03:18 GMT
Expires →-1
Pragma →no-cache
Server →Microsoft-IIS/7.5
X-AspNet-Version →4.0.30319
X-Powered-By →ASP.NET
Response header while hitting api hosting from vs2012 debug
Cache-Control →no-cache
Content-Length →2399
Content-Type →application/json; charset=utf-8
Date →Thu, 19 Dec 2013 07:07:22 GMT
Expires →-1
Last-Modified →Wed, 18 Dec 2013 07:07:22 GMT
Pragma →no-cache
Server →Microsoft-IIS/8.0
X-AspNet-Version →4.0.30319
X-Powered-By →ASP.NET
X-SourceFiles →=?UTF-8?B?QzpcU291cmNlXGFwbVxzcmNcc2VydmljZXNcV2Vic2VydmljZXNcQ0lTXGFwbVxwcm9wZXJ0eWRhdGFcYXV0b3N1Z2dlc3RcdjFcZnJlZXRleHQ=?=