Response.ContentType使用ASP.NET MVC对IE8进行了不同程度的更改 [英] Response.ContentType sporaticly changes for IE8 using ASP.NET MVC
问题描述
我们在IIS6上运行ASP.NET MVC。我们已经开始注意到IE8客户端的问题。
几乎所有时间,返回的ContentType是'text / html',但偶尔会返回'application / xhtml + xml'。这导致IE8尝试下载文件,而不是在浏览器中呈现内容。
We are running ASP.NET MVC on IIS6. We have started to notice a problem with IE8 clients. Almost all the time, the ContentType returned is 'text/html' but occasionally, it will be returned as 'application/xhtml+xml'. This is causing IE8 to try and download the file instead of rendering the contents in the browsers.
我找不到ContentType更改的任何原因。来自浏览器的请求看起来一样。
I can't find any reason for the ContentType to change. The requests from the browser look the same.
- ASP.NET / MVC管道中设置的ContentType在哪里?
- 任何想法是什么可能会导致某些更改ContentType的请求?
更新信息
- 我们使用MVC框架提供的默认ViewEngine。
- 这种情况发生在多台机器上。
推荐答案
听起来有人试图根据用户代理请求标题改变内容类型;发送text / html到IE,因为它不支持XHTML。
It sounds like somebody is trying to vary the content-type based on the User-Agent request header; sending text/html to IE because it doesn't support XHTML.
如果是这种情况,也许有一个中间(代理)为你提供一个不同的UA响应。检查Cache-Control和Vary响应头。
If this is the case, maybe there's an intermediate (proxy) serving you a response for a different UA. Check Cache-Control and Vary response headers.
这篇关于Response.ContentType使用ASP.NET MVC对IE8进行了不同程度的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!