title: Excel Export in Classic ASP
body: <p>I am asked to look at an issue in Prod in a classic ASP application. The excel export of data is not working. I seek your help as I do not have good experience in classic asp. Here is what is written in code:</p>
  
  <pre><code>    Session("aviAF_ExcelExporter") = buff.Contents()
      Response.Redirect("/WebFramework/content.xls")
  </code></pre>
  
  <p>And there is an excel file in the /WebFramework/ folder, named content.xls and this is written in the excel file:</p>
  
  <pre><code>    &lt;%
      Response.ContentType = "application/ms-excel" 
      Response.Write Session("aviAF_ExcelExporter") &amp; vbCrLf
      %&gt;
  </code></pre>
  
  <p>There is a server migration going on and this issue started since the application is migrated.</p>
  
  <p>My questions are:</p>
  
  <p>1.Do we need excel be installed on the new server?</p>
  
  <p>2.Because we are creating .xls, do we need older version of excel installed or do we need   to create a new .xls file with same content using the newer version of excel?</p>
  
  <p>3.If this needs an older version of excel to be installed, and the server is 2012, can we register any com components instead because installed older version of excel is not possible?</p>
  
  <p>4.OR, if a code change is necessary, Do we need to change the code in the content.xls file to be compatible with newer excel? If so, can someone please help on how the code needs to be changed?</p>
  
  <p>Thank you very much!</p>
  
  <p>UPDATE:</p>
  
  <p>This following solution worked for me:</p>
  
  <p>Changed the content.xls to content.asp first and then changed code as below:</p>
  
  <pre><code>    Session("aviAF_ExcelExporter") = buff.Contents()
      Response.Redirect("/WebFramework/content.asp")
  </code></pre>
  
  <p>Within the content.asp, changed the code to:</p>
  
  <pre><code>    &lt;%
      Response.ContentType = "application/vnd.ms-excel" 
      Response.Write Session("aviAF_ExcelExporter") &amp; vbCrLf
      %&gt;
  </code></pre>
  
  <p>This is now exporting as expected to excel.</p>
  
  <p>Thanks for looking into. Please share any alternative answers if you have.</p>