title: How to stream an in-memory xml document as an attachment on an asp.net mvc site
body: <p>I thought MVC was supposed to make all this easier but I'm trying various ways and getting issues.</p>
  
  <p>If I try the accepted answer for this question (changing the content type accordingly)... <a href="https://stackoverflow.com/questions/1375486/how-to-create-file-and-return-it-via-fileresult-in-asp-net-mvc">How to create file and return it via FileResult in ASP.NET MVC?</a></p>
  
  <p>...I get into trouble because my encoding in the xml file is UTF-16. </p>
  
  <p>The error I get is: </p>
  
  <p><strong>Switch from current encoding to specified encoding not supported. </strong></p>
  
  <p>This suggests that somewhere I need to tell MVC that I want UTF-16. Alternatively I want a different method that uses binary and not text.</p>