title: Excel download not happening from server
body: <p>I am trying to download an Excel file from the server on a button click, but it is not happening. It simply executes the code but the download is not happening.</p>
  <pre><code>Protected Sub btn_dwnldexcel_Click(sender As Object, e As EventArgs) Handles btn_dwnldexcel.Click
          Dim fileToDownload = Server.MapPath(&quot;./Data/nd_format.xls&quot;)
          ''Response.ContentType = &quot;application/octet-stream&quot;
          Response.ContentType = &quot;application/vnd.ms-excel&quot;
          Dim cd = New ContentDisposition()
          cd.Inline = False
          cd.FileName = Path.GetFileName(fileToDownload)
          Response.AppendHeader(&quot;Content-Disposition&quot;, cd.ToString())
          Dim fileData As Byte() = System.IO.File.ReadAllBytes(fileToDownload)
          Response.OutputStream.Write(fileData, 0, fileData.Length)
  End Sub
  </code></pre>
  <p>Any idea would be appreciated.</p>