1
我得到了XML文件與下面的代碼更改的Xml ..IE通過Ajax調用
var uploadInfo = context.Request.Files[0];
var uploadStream = uploadInfo.InputStream;
var upload = new byte[uploadInfo.ContentLength];
uploadStream.Read(upload, 0, uploadInfo.ContentLength);
var payload = System.Text.Encoding.UTF8.GetString(upload);
context.Response.ContentType = "text/plain";
context.Response.Write(payload);
的XML看起來像這樣的作爲expceted這一點..
<?xml version="1.0"?>
<AData>
<DataElement name="Comments" type="String"></DataElement>
<DataElement name="ModAuthor" type="String"></DataElement>
<DataElement name="CreateDate" type="Datetime"></DataElement>
<DataElement name="Author" type="String"></DataElement>
</AData>
我用這個代碼呼叫我的處理程序..
在鉻一切都很好,但在IE中測試成功的方法返回以下..
<DIV class=e><SPAN class=b> </SPAN> <SPAN class=m><?</SPAN><SPAN class=pi>xml version="1.0" </SPAN><SPAN class=m>?></SPAN> </DIV>
<DIV class=e>
<DIV style="TEXT-INDENT: -2em; MARGIN-LEFT: 1em" class=c><A class=b onfocus=h() onclick="return false" href="#">-</A> <SPAN class=m><</SPAN><SPAN class=t>AData</SPAN><SPAN class=m>></SPAN></DIV>
<DIV>
<DIV class=e>
<DIV style="TEXT-INDENT: -2em; MARGIN-LEFT: 1em"><SPAN class=b> </SPAN> <SPAN class=m><</SPAN><SPAN class=t>DataElement</SPAN> <SPAN class=t>name</SPAN><SPAN class=m>="</SPAN><B>Comments</B><SPAN class=m>"</SPAN><SPAN class=t> type</SPAN><SPAN class=m>="</SPAN><B>String</B><SPAN class=m>"</SPAN><SPAN class=m> /></SPAN> </DIV></DIV>
<DIV class=e>
<DIV style="TEXT-INDENT: -2em; MARGIN-LEFT: 1em"><SPAN class=b> </SPAN> <SPAN class=m><</SPAN><SPAN class=t>DataElement</SPAN> <SPAN class=t>name</SPAN><SPAN class=m>="</SPAN><B>ModAuthor</B><SPAN class=m>"</SPAN><SPAN class=t> type</SPAN><SPAN class=m>="</SPAN><B>String</B><SPAN class=m>"</SPAN><SPAN class=m> /></SPAN> </DIV></DIV>
<DIV class=e>
<DIV style="TEXT-INDENT: -2em; MARGIN-LEFT: 1em"><SPAN class=b> </SPAN> <SPAN class=m><</SPAN><SPAN class=t>DataElement</SPAN> <SPAN class=t>name</SPAN><SPAN class=m>="</SPAN><B>CreateDate</B><SPAN class=m>"</SPAN><SPAN class=t> type</SPAN><SPAN class=m>="</SPAN><B>Datetime</B><SPAN class=m>"</SPAN><SPAN class=m> /></SPAN> </DIV></DIV>
<DIV class=e>
<DIV style="TEXT-INDENT: -2em; MARGIN-LEFT: 1em"><SPAN class=b> </SPAN> <SPAN class=m><</SPAN><SPAN class=t>DataElement</SPAN> <SPAN class=t>name</SPAN><SPAN class=m>="</SPAN><B>Author</B><SPAN class=m>"</SPAN><SPAN class=t> type</SPAN><SPAN class=m>="</SPAN><B>String</B><SPAN class=m>"</SPAN><SPAN class=m> /></SPAN> </DIV></DIV>
<DIV><SPAN class=b> </SPAN> <SPAN class=m></</SPAN><SPAN class=t>AData</SPAN><SPAN class=m>></SPAN></DIV></DIV></DIV>
任何想法我能做些什麼來簡單地返回xml字符串我從處理程序代碼中獲取?它在鉻中返回xml的罰款,但IE瀏覽器給我什麼看起來是html和樣式自動。
複製? http://stackoverflow.com/questions/14074431/xml-not-sent-to-client-through-response-object-correctly-in-ie – gregpakes 2013-03-06 21:09:11