Ich habe eine MVC Aktion, die wie folgt aufgerufen:MVC FilePathResult Aktion verursacht Wiederholungsanforderung in Chrome
http://localhost/Report/PrintContainerMasterTrayList?containerMasterId=x&type=downloadview
Die Aktion hat die folgende Signatur
public ActionResult PrintContainerInstanceTrayList(int containerInstanceId, string type)
dass ein FilePathResult kehrt wie folgt :
return File(filename, "application/pdf");
Dies ist alles gut, außer dass in Chrome die Anfrage zweimal ausgelöst wird. Die Anfrage wird nur einmal in Firefox und IE11 gemacht.
Die ursprüngliche Anfrage
GET http://localhost/DEV-SAF/Report/PrintContainerMasterTrayList?containerMasterId=x&type=downloadview HTTP/1.1 Host: localhost Connection: keep-alive Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Encoding: gzip, deflate, sdch Accept-Language: en-GB,en;q=0.8 Cookie: .ASPXANONYMOUS=-
Die zweite Anfrage
GET http://localhost/DEV-SAF/Report/PrintContainerMasterTrayList?containerMasterId=x&type=downloadview HTTP/1.1 Host: localhost Connection: keep-alive User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36 Accept: */* Referer: http://localhost/DEV-SAF/Report/PrintContainerMasterTrayList?containerMasterId=x&type=downloadview Accept-Encoding: gzip, deflate, sdch Accept-Language: en-GB,en;q=0.8
Die Antwort von beiden Anfragen gleich ist (in diesem Fall zu einer 4 MB-Datei, auf die sich verwendet übermäßige Bandbreite).
Was verursacht dieses Verhalten?
bearbeiten
Die Antwort vom ersten Anfrage ist HTTP/1.1 200 OK Cache-Control: private, s-maxage=0 Content-Type: application/pdf Server: Microsoft-IIS/10.0 Set-Cookie: .AUTH=xxxxxx; path=/; HttpOnly X-AspNetMvc-Version: 5.2 Date: Wed, 03 Aug 2016 14:17:41 GMT Content-Length: 3999
Die Antwort von der zweiten Anfrage ist HTTP/1.1 200 OK Cache-Control: private, s-maxage=0 Content-Type: application/pdf Server: Microsoft-IIS/10.0 X-AspNetMvc-Version: 5.2 Date: Wed, 03 Aug 2016 14:17:46 GMT Content-Length: 3999
Anforderung Sie einfügen sind nicht gleich, zum Beispiel, containerMasterId = 94101 und containerMasterId = x in Abfragezeichenfolge zu vergleichen –
Sorry, das war ich kopieren und einfügen. Bearbeitet den Beitrag. – Fishcake
werden diese beiden Anfragen zusammen oder einzeln ausgelöst? –