In HTTP, the save request and the XML file, and then Render

In the web application being created, users can locally back up their data. Backup data is an XML file. At the moment, most browsers are trying to display this file. What should I change in the HTTP response to suggest to the user agent that the file should be saved?

+3
source share
2 answers

You need a Content-Disposition header:

Content-Disposition: attachment; filename=my_backup.xml
+2
source

You need to use the content setting, for example:

AppendHeader("Content-Disposition", "filename=MyExportedFile.xml");

This will give you a save request, not an attempt to render to the screen

0
source

Source: https://habr.com/ru/post/1716124/


All Articles