开发者

Why is Internet Explorer (8) thinking this is XML

This is the Raw response that is generated from the server (using Fiddler2)

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/plain; charset=utf-8
Server: Microsoft-IIS/7.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
MicrosoftOfficeWebServer: 5.0_Pub
MS-Author-Via: MS-FP/4.0
Date: Fri, 10 Dec 2010 18:19:18 GMT
Content-Length: 594

Contents of 24194_XXXXXXXXXX.log as of 10/12/2010 19:19:18
w3wp.exe Information: 0 : START: New Alarm [9]
w3wp.exe Information: 0 : 12/10/2010 19:14:56 - <?xml version="1.0"?>
<CALLS>
  <CALL>
    <CALL_ID>9_1</CALL_ID>
    <BODY>004|007|015|058|1_ToConfirm|2_ToDecline</BODY>
    <LANGID>321</LANGID>
    <TO1>99999999999</TO1>
    <TO2 />
  </CALL>
</CALLS>
w3wp.exe Information: 0 : END: New Alarm [9]
w3wp.exe Information: 0 : 12/10/2010 19:15:30 - <RESULT><CA开发者_运维技巧LL_ID>9_1</CALL_ID><CALLRESULT1>0</CALLRESULT1><DTMF1>2</DTMF1><CALLRESULT2></CALLRESULT2><DTMF2></DTMF2></RESULT>

In my asp.net IHttpHandler I have set

           context.Response.ContentType = "text/plain";

Which it is clearly returning. In IE8 I get to see this:

Why is Internet Explorer (8) thinking this is XML

When I try the Save Target As... I get this (Notice the Save as type:):

Why is Internet Explorer (8) thinking this is XML


IE is kind of notorious for second-guessing the content type. Presumably they're doing content-sniffing and the <?xml version="1.0"?> is tripping it up.

Try using a different content type other than text/plain or application/octet-stream to see if you get the same behavior. It's looks like it only does the sniffing for those two types in an attempt to work around misconfigured web servers:

See also http://msdn.microsoft.com/en-us/library/ms775147(VS.85).aspx#introduction


It's looking at your actual content which has xml in it:

<?xml version="1.0"?>

It's easy to understand why when you don't have any html elements such as html, head, or body. If you want the xml to be displayed as text then you will need to include in html and escape the markup properly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜