title: Creating and Exporting Excel using Microsoft.Office.Interop.Excel.dll refeshing the page
body: <p>Server has Microsoft Office 2003. Code is as below</p>
  
  <p>at aspx Page</p>
  
  <pre><code>&lt;asp:UpdatePanel ID="UpdatePanel2" runat="server"&gt;
    &lt;ContentTemplate&gt;
      &lt;asp:LinkButton ID="ExportExcel" runat="server" OnClick="ExportTabletoExcel_Click" OnClientClick="ExportTableJqueryMethod"&gt;ExportExcel&lt;/asp:LinkButton&gt;
   &lt;/ContentTemplate&gt;
    &lt;Triggers&gt;
      &lt;asp:PostBackTrigger ControlID="ExportExcel" /&gt;
    &lt;/Triggers&gt;
  &lt;/asp:UpdatePanel&gt;
  </code></pre>
  
  <p>At Code behind</p>
  
  <pre><code>using Excel1= Microsoft.Office.Interop.Excel;
  ...
  protected void ExportTabletoExcel_Click(object sender, EventArgs e)
  {
  Excel1.Application excelApp = new Excel1.Application();
  ...//Adding Data to Excel
  excelWorkBook.SaveAs(path, Excel1.XlFileFormat.xlWorkbookNormal);
  excelWorkBook.Close();
  
  ...//to download
  HttpContext.Current.Response.ContentType = "application/xls";
  HttpContext.Current.Response.AppendHeader("content-disposition", "attachment; &gt; filename=ExportedExcel.xls");
  HttpContext.Current.Response.WriteFile(path + ".xls");
  }
  </code></pre>
  
  <p>In Web.config
  <code>&lt;add assembly="Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"/&gt;</code></p>
  
  <p>on click in Visual Studio the excel downloads just fine. But while running the same on server refreshes the page and no excel downloads.</p>