title: ASP.NET MVC: C# Download file and save as dialog
body: <p>i've written this code which will generate an excel spreadsheet and save it to a specified location. I want to then display a "Save as" dialogue box by reading the file from the stored location and then asking then user where they want to store it.</p>
  
  <pre><code>Excel.Application excelApp = null;
              Excel.Workbook wb = null;
              Excel.Worksheet ws = null;
              Excel.Range range = null;
  
  excelApp = new Excel.Application();
              wb = excelApp.Workbooks.Add();
              ws = wb.Worksheets.get_Item(1) as Excel.Worksheet;
  
  for(int i = 0; i&lt; 10;++i) {
      ws.Cells[i, 1] = i+
  }
  
  wb.SaveAs(@"C:\test.xls", Excel.XlFileFormat.xlWorkbookNormal);
  wb.Close(true);
  excelApp.Quit();
  </code></pre>
  
  <p>How to download in the following format?</p>
  
  <pre><code>string str = "Hello, world"; 
  
  byte[] bytes = System.Text.Encoding.UTF8.GetBytes(str); 
  
  return File(bytes, "text/plain"); 
  </code></pre>