Monday, 28 October 2019

How to download file with asp.net on buttton's onClick event?

How to download file with asp.net on buttton's onClick event?



This will help you
private void Button1_click(object sender, System.EventArgs e)
{
    Response.ContentType = "Application/pdf";
    Response.AppendHeader("Content-Disposition", "attachment; filename=help.pdf");
    Response.TransmitFile(Server.MapPath("~/doc/help.pdf"));
    Response.End();
}

No comments:

Post a Comment