Asp.net Firefox&;IE:从缓存检索时损坏的数据

Asp.net Firefox&;IE:从缓存检索时损坏的数据,asp.net,caching,http-headers,etag,Asp.net,Caching,Http Headers,Etag,我向服务器发出了如下请求: http://localhost/Combine.aspx/flag/file1.js,file2.js,file3.js ��������`I�%&/m�{J�J��t��`$�����iG#)�*��eVe]f@�흼��{���{��;�N' 我也试过: http://localhost/Combine.aspx/flag/value/file1.js/file2.js/file3.js 它只是简单地结合了提供的三个文件:这很好用 当Firefox发

我向服务器发出了如下请求:

http://localhost/Combine.aspx/flag/file1.js,file2.js,file3.js
��������`I�%&/m�{J�J��t��`$�����iG#)�*��eVe]f@�흼��{���{��;�N'
我也试过:

http://localhost/Combine.aspx/flag/value/file1.js/file2.js/file3.js
它只是简单地结合了提供的三个文件:这很好用

当Firefox发出第一个请求时,页面显示正确。再次刷新页面时,内容如下所示:

http://localhost/Combine.aspx/flag/file1.js,file2.js,file3.js
��������`I�%&/m�{J�J��t��`$�����iG#)�*��eVe]f@�흼��{���{��;�N'
在这种情况下,不会向服务器发出任何请求,据我所知,该文件仅从firefox缓存中检索

如果我使用Control-F5强制刷新页面,页面看起来会再次正常

以下是带有Control-F5的请求和响应(在firebug中)(有效):

响应

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
请求

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
我能说的唯一不同的是内容长度(这可能会导致损坏),但由于它从未到达服务器,我无法控制它

这可能是什么原因造成的

编辑:

IE8上也会发生这种情况,但它不会查看损坏的文件,而是下载损坏的文件。从未向服务器发出任何请求(在visual studio中设置断点)

至于chrome,当直接查看url时,每次都会向服务器发出请求,并且每次都有效。不过,我相信,如果它包含在标签中,它的行为将类似于Firefox

哦,还有:

如果我关闭Expires头(这是URL中的标志之一),一切正常

编辑2:


我可以通过不发送Expires和ETag头来解决这个问题,只发送其中一个。我不知道为什么ETag头会导致这种损坏。

这是因为您的IIS配置。将IIS调整为ASP 4.0经典版,而不是默认的应用程序池,这很奇怪。您是否已经尝试过从Firefox的设置中清除缓存?你有没有在其他浏览器上尝试过这一点,看看是否会出现同样的错误?请看编辑,它发生在IE8中,而不是chrome(直接查看url时)。我也有同样的问题。我看了又看,但我找不到发生这种情况的原因。