title: Excel file is in a different format specified by the file extension (Excel exported from gridview)
body: <p>I'm exporting a gridview to an excel file and it opens just fine. Only thing is, this warning always pops up every time the excel file is opened:</p>
  
  <p><code>The file you are trying to open &lt; &gt; 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 file now?</code></p>
  
  <p>Code I'm using:</p>
  
  <pre><code>        HttpContext.Current.Response.Clear();
          HttpContext.Current.Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "Single_Raw.xls"));
          HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
  
      using (StringWriter sw = new StringWriter())
      {
          using (HtmlTextWriter htw = new HtmlTextWriter(sw))
          {
             // some code
  
              HttpContext.Current.Response.Write(sw.ToString());
              HttpContext.Current.Response.End();
          }
      }
  </code></pre>