In our code, there is an option to export metadata as an XML file. The code that does that is below:
string xml = ToXML(metadatas, files);
context.Response.AddHeader("Content-Type", "application/octet-stream");
context.Response.AddHeader("Content-Disposition", "attachment; filename=video_metadata.xml;");
context.Response.Write(xml);
context.Response.Flush();
context.Response.End();
This works just fine in Firefox. They click the button and are prompted to save the xml file. However, in Chrome, there is no save file prompt. Using fiddler, I can see that the xml data is all there in the response, and it has a status code of 200. There are no errors shown on my web server, and the client side shows no indication of error, either. It just doesn't recognize the data sent back as something to save into a file.
Any help would be much appreciated. On the same web server, we are able to successfully export csv files with the headers as such:
context.Response.AddHeader("Content-Type", "application/vnd.ms-excel");
context.Response.AddHeader("Content-Disposition", "attachment; filename=AssetList.csv;");
Edit: I tried both text/xml
and application/xml
, but unfortunately neither solved my problem.