Sto tentando di caricare un file e restituire una risposta JSON relativa alle proprietà (nome, dimensione, ecc.) Del file. Funziona bene in tutti i browser tranne IE.Download risposta Json in IE (7 ~ 10)
IE tenta di scaricare il JSON come file!
Ho IE10 e testarlo su IE7 a 10 cambiando la modalità browser e la modalità documento dal debugger.
Sto usando asp.net mvc4, l'azione di caricamento del file ha attributo HttpPost e sto restituendo la risposta di JSON usando return Json (myObject);
E qui sono i miei intestazioni HTTP
Richiesta
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
risposta
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
ho provato un paio di suggerimenti, ma così indietro al punto di partenza!
Quindi ... qual è il problema? –
my bad ... IE tenta di scaricare json come file – smehnawal
possibile duplicato di [IE richiede di aprire o salvare i risultati JSON dal server] (http://stackoverflow.com/questions/6114360/ie-prompts-to-open -or-save-json-result-from-server) –