Author: andywan | Posted on: 8/14/2009 8:29:57 PM | Views : 310

When I am using AJAX to call web service, i find that the "Cache Expires" is set to one year ago in the response header.
For example:
here is the response content after requests to "/WebServices/Common.asmx/js":
HTTP/1.1 200 OK
Date: Sat, 15 Aug 2009 03:02:44 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: public
Expires: Thu, 14 Aug 2008 10:17:13 GMT
Last-Modified: Fri, 14 Aug 2009 10:17:13 GMT
Content-Type: application/x-javascript; charset=utf-8
Content-Length: 21028

I try to view the source code of System.Web.Extensions.dll using Reflector,
here is some code of "WebServiceClientProxyGenerator.GetClientProxyScript" method:
 if (!debug && (assemblyModifiedTime.ToUniversalTime() < DateTime.UtcNow))
    {
        HttpCachePolicy ...

Go to the complete details ...