开发者

Download file on ImageButton Click event

开发者 https://www.devze.com 2022-12-10 14:02 出处:网络
I have a link of a file, and I don\'t know how to add it to imagebutton. I want to see the \'open-save-cance开发者_开发问答l\' , screen when imagebutton is clicked, but imagebutton doesn\'t seems to b

I have a link of a file, and I don't know how to add it to imagebutton. I want to see the 'open-save-cance开发者_开发问答l' , screen when imagebutton is clicked, but imagebutton doesn't seems to be taking the link of file as a file, but taking it as a page url and tring to open the file url as page.

Thanks


    //OnClick server Handler

    Response.Clear();
    Response.AddHeader(
        "content-disposition", string.Format("attachment; filename={0}", "file_name"));

    Response.ContentType = "application/octet-stream";

    Response.WriteFile("file_path");
    Response.End();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号