开发者

Download file on ImageButton Click event

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜