title: Is it possible to output .XLSX file with XSLT in ASP.NET Response
body: <p>I currently have a .xsl file which I am using XSLT with to output it as a .xls file and open it with excel.</p>
  
  <p>I am outputting this in an ASP.NET application using the response object as follows:</p>
  
  <pre><code>context.Response.ContentType = "application/vnd.ms-excel";
  context.Response.AddHeader("content-disposition", "inline;filename=MyFile.xml");
  </code></pre>
  
  <p>However, this outputs the file as a .xsl extension and displays the following popup message:
  "The file you are trying to open, 'MyFile.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the now?"</p>
  
  <p>I am trying to find out two things, is it possible to output this as a .xlsx extension? Because when I try to do that and change the content type it simply doesn't allow me to open the file until I set the extension back to .xls.</p>
  
  <p>The second, is how do you get rid of that message by making changes to the code? I have found a few responses that simply instruct you to change settings such as here: <a href="http://support.microsoft.com/kb/948615" rel="nofollow">http://support.microsoft.com/kb/948615</a></p>
  
  <p>However the client requests the error message not be displayed at all. Any help is appreciated here, thanks.</p>