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

前端 未结 5 1955
时光取名叫无心
时光取名叫无心 2021-02-06 15:37

I have a String variable (in C#) that contain the full path of PDF file on my server (like that \"~/doc/help.pdf\").

I want that in click on button, this file will down

5条回答
  •  南笙
    南笙 (楼主)
    2021-02-06 16:17

    Try this code on your btn_Click:

    Response.Redirect("~/doc/link.pdf");
    

提交回复
热议问题