.net 2.0 中点击下载文件的方法

        Response.ContentType = "application/octet-stream";
        
string filename = e.CommandArgument.ToString();
        filename 
= UploadHelper.getFileName(filename.Replace("/","\"));
        Response.AddHeader(
"Content-Disposition""attachment;filename=" + filename);
        
string filepath = Server.MapPath(e.CommandArgument.ToString());
        Response.TransmitFile(filepath);
 

Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1764788

posted @ 2007-09-22 00:37  星空竹月  阅读(304)  评论(1编辑  收藏  举报