title: Unable to download docx file using C#
body: <p>This is my code and I am trying since hours to download the docx file. but no success.
  Where I might be lagging, need a slight hint.</p>
  
  <pre><code>if (File.Exists(sTempPath + sCreateFileName))
              {
                  FileInfo file =new FileInfo(sTempPath + sCreateFileName);
                  Response.ClearContent();
                  // LINE1: Add the file name and attachment, which will force the open/cancel/save dialog to show, to the header
                  Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
                  // Add the file size into the response header
                  Response.AddHeader("Content-Length", file.Length.ToString());
                  // Set the ContentType                        
                  Response.ContentType = ReturnExtension(file.Extension.ToLower());
                  // Write the file into the response (TransmitFile is for ASP.NET 2.0. In ASP.NET 1.1 you have to use WriteFile instead)
                  Response.TransmitFile(sTempPath + sCreateFileName);
                  // End the response
                  HttpContext.Current.ApplicationInstance.CompleteRequest();
              } 
  </code></pre>
  
  <p>and Return content type gives, content type for docx file:</p>
  
  <pre><code>"application/ms-word"
  </code></pre>
  
  <p>where if sTempPath+sCreateFileName is the whole path of the file.</p>
  
  <p><strong>Update:</strong>
  I tried content type:</p>
  
  <pre><code>application/vnd.openxmlformats-officedocument.wordprocessingml.document
  </code></pre>
  
  <p>This is not working.</p>