title: Saving XML files from a dataSet through ASP.NET
body: <p>Currently I have two code samples, once takes a table from my database, puts it into a DataSet and then saves the DataSet and an XML file to my desktop.</p>
  
  <p>The other code saves a file from a webpage. What I would like to do is combine these two code examples so that I can save my XML file through the internet.</p>
  
  <p>Here are the samples:</p>
  
  <pre><code>SqlDataAdapter adapter = new SqlDataAdapter(query, connectionString);
              DataSet questionSet = new DataSet();
              adapter.Fill(questionSet, "Questions");
  
              questionSet.WriteXml("../../../../../Users/User/Desktop/MyTest");
  </code></pre>
  
  <p>This successfully saves my table as an XML document and saves it to my Desktop.</p>
  
  <p>The <a href="http://msdn.microsoft.com/en-us/library/aa478985.aspx#aspnet-jspmig-downloadinganduploading_topic6" rel="nofollow">code sample from the MSDN</a> for saving files through ASP.NET</p>
  
  <pre><code>System.String filename = "myFile.txt";
  
                     Response.ContentType = "text/xml";
  
                     // initialize the http content-disposition header to
                     // indicate a file attachment with the default filename
                     // "myFile.txt"
                     System.String disHeader = "Attachment; Filename=\"" + filename +
                        "\"";
                     Response.AppendHeader("Content-Disposition", disHeader);
  
                     // transfer the file byte-by-byte to the response object
                     System.IO.FileInfo fileToDownload = new
                        System.IO.FileInfo("C:\\downloadJSP\\DownloadConv\\myFile.txt");
                     Response.Flush();
                     Response.WriteFile(fileToDownload.FullName);}
  </code></pre>
  
  <p>This successfully saves a file through my browser.</p>
  
  <p>As far as I understand it, it seems that <code>.WriteXml</code> creates a the file from the dataSet. Is there a way to throw that file at the other code and tell the browser to download the <code>.WriteXml</code> file instead?</p>
  
  <p>All of this code looks almost like magic to me, but then again, it's .NET, which is known for its pixie dust!</p>