我对服务器有一个请求,如下所示:
http://localhost/Combine.aspx/flag/file1.js,file2.js,file3.js
我也试过这个:
http://localhost/Combine.aspx/flag/value/file1.js/file2.js/file3.js
它简单地结合了它给出的三个文件:这很好用。
在 Firefox 发出第一个请求时,页面会正确显示。再次刷新页面时,内容如下所示:
��������`I�%&/m�{J�J��t��`$�����iG#)�*��eVe]f@�흼��{���{��;�N'
在这种情况下,不会向服务器发出请求,据我所知,该文件仅从 firefox 缓存中检索。
如果我用 Control-F5 强制刷新页面,页面看起来又正常了。
这是使用Control-F5 (有效)的请求和响应(在萤火虫中):
回复
Cache-Control public
Content-Type application/javascript; charset=utf-8
Content-Encoding gzip
Expires Sun, 26 Feb 2012 02:57:26 GMT
Last-Modified Fri, 07 Jan 2011 21:08:54 GMT
Etag CLYvZwbFmainWEMi8h-6x-zNEIQ1
Vary Accept-Encoding
Server Microsoft-IIS/7.5
Set-Cookie auth=longstring; path=/
X-AspNet-Version 2.0.50727
X-Powered-By ASP.NET
Date Thu, 03 Mar 2011 02:57:26 GMT
Content-Length 918
要求
Host localhost
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.14) Gecko/20110218 Firefox/3.6.14
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/;q=0.8
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 115
Connection keep-alive
Cookie auth=longstring
Pragma no-cache
Cache-Control no-cache
这与F5相同(不起作用):
回应:
Cache-Control public
Content-Type application/javascript; charset=utf-8
Content-Encoding gzip
Expires Sun, 26 Feb 2012 02:57:26 GMT
Last-Modified Fri, 07 Jan 2011 21:08:54 GMT
Etag CLYvZwbFmainWEMi8h-6x-zNEIQ1
Vary Accept-Encoding
Server Microsoft-IIS/7.5
X-AspNet-Version 2.0.50727
X-Powered-By ASP.NET
Date Thu, 03 Mar 2011 03:01:31 GMT
Content-Length 1533
要求:
Host localhost
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.14) Gecko/20110218 Firefox/3.6.14
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/;q=0.8
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 115
Connection keep-alive
Cookie auth=longstring
我能说的唯一不同是 Content-Length (这可能会导致损坏),但由于它从不访问服务器,所以我无法控制它。
这可能是什么原因造成的?
编辑:
这也发生在 IE8 上,但不是查看损坏的文件,而是下载损坏的文件。从未向服务器发出任何请求(在 Visual Studio 中设置断点)。
至于chrome,直接查看url时,每次都向服务器发出请求,每次都有效。不过,我相信,如果它包含在标签中,它的行为将类似于 Firefox。
哦,还有:
如果我关闭 Expires 标头(这是 URL 中的标志之一),一切正常。
编辑2:
我能够通过不发送Expires 和 ETag 标头,仅发送一个或另一个来解决此问题。不过,我不知道为什么 ETag 标头会导致这种损坏。