title: Download an Excel file
body: <p>I have read some past posts here on how to download a Excel file from a website.  So, I have setup the below code:</p>
  
  <pre><code>string path = MapPath(fname);
  string name = Path.GetFileName(path);
  string ext = Path.GetExtension(path);
  string type = "application/vnd.ms-excel";
  
  
  if (forceDownload)
  {
      Response.AppendHeader("content-disposition",
          "attachment; filename=" + name);
  }
  
  if (type != "")
  {
      Response.ContentType = type;
      Response.WriteFile(path);
      Response.End();
  }
  </code></pre>
  
  <p>However, I get no download dialog box.</p>
  
  <p>I try this both in IE 8 and FireFox 10.0.2.<br>
  The file is there, it's not locked, and it's not set to read only.<br>
  I'm not sure were I went wrong.</p>