I use the below code in mvc to download Excel file but it shows error query string too long.
public ActionResult Download(string input)
{
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.Buffer = true;
Response.AddHeader("Content-Disposition", "attachment; filename= download.xlsx");
Response.AddHeader("Content-Type", "application/Excel");
Response.ContentType = "application/vnd.ms-excel";
Response.WriteFile(input);
Response.End();
return Content(String.Empty);
}
This code works for me for PDF:
I really think that your ActionResult will not work.