views:

47

answers:

2

In a Web Application I am creating, users can backup their data locally. The backup data is an XML file. At the moment, most browsers try to display this file. What should I change in the HTTP response to suggest to a user-agent that the file should instead be saved?

+1  A: 

You need a Content-Disposition header:

Content-Disposition: attachment; filename=my_backup.xml
Ned Batchelder
A: 

You need to use content disposition like:

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

This will give you a save prompt rather than attempt to render to screen

Wolfwyrd