Response.ContentType = "application/pdf";
Response.AppendHeader("Content-Disposition", "attachment; filename=MyFile.pdf");
//MyFile.pdf should be present in Files folder on server. other wise it will show error file not found.
Response.TransmitFile(Server.MapPath("~/Files/MyFile.pdf"));
Response.End();
reference:-https://www.c-sharpcorner.com/UploadFile/afenster/how-to-download-a-file-in-Asp-Net/
No comments:
Post a Comment