sme*_*wal 31 internet-explorer json http-headers c#-4.0 asp.net-mvc-4
我正在尝试上传文件并返回有关文件属性(名称,大小等)的json响应.它在除IE之外的所有浏览器中都能正常工
IE尝试将JSON下载为文件!
我有IE10并通过从调试器更改浏览器模式和文档模式在IE7到10上测试它.
我使用的是asp.net mvc4,文件上传操作有HttpPost属性,我使用return Json(myObject)返回json响应;
这是我的http标题
请求
Key Value
Request POST /File/UploadFile/ HTTP/1.1
Accept text/html, application/xhtml+xml, */*
Referer http://localhost:63903/
Accept-Language en-NZ
User-Agent Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Content-Type multipart/form-data; boundary=---------------------------7dc1e71330526
Accept-Encoding gzip, deflate
Host localhost:63903
Content-Length 1377002
DNT 1
Connection Keep-Alive
Cache-Control no-cache
Run Code Online (Sandbox Code Playgroud)
响应
Key Value
Response HTTP/1.1 200 OK
Server ASP.NET Development Server/11.0.0.0
Date Tue, 18 Dec 2012 23:44:19 GMT
X-AspNet-Version 4.0.30319
X-AspNetMvc-Version 4.0
Cache-Control private
Content-Type application/json; charset=utf-8
Content-Length 154
Connection Close
Run Code Online (Sandbox Code Playgroud)
我尝试了一些建议,但到目前为止还没回到原点!
Gab*_*oli 46
你将需要返回json,text/html
因为IE不知道如何处理application/json
内容..
return Json(myObject, "text/html");
Run Code Online (Sandbox Code Playgroud)
不确定,但它可能会起作用(如果它确实会更正确)text/x-json
return Json(myObject, "text/x-json");
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
25352 次 |
最近记录: |