Download der Json-Antwort im IE (7 ~ 10)
Ich versuche, eine Datei hochzuladen und eine JSON-Antwort bezüglich der Eigenschaften (Name, Größe usw.) der Datei zurückzugeben. Es funktioniert in allen Browsern außer IE.
IE versucht den JSON als Datei herunterzuladen!
Ich habe IE10 und teste es auf IE7 bis 10, indem ich den Browsermodus und den Dokumentmodus vom Debugger aus ändere.
Ich benutze asp.net mvc4, die Datei-Upload-Aktion hat das HttpPost-Attribut und ich gebe die json-Antwort mit zurückreturn Json (myObject);
Und hier sind meine http-Header
Anfordern
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
Antwort
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
Ich habe ein paar Vorschläge ausprobiert, aber so weit zurück zum ersten!