string pathfile=targetfile;  //pathfile 是要下载的文件名称
    System.IO.FileInfo file=new System.IO.FileInfo(pathfile);
    Response.Clear();
    Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(file.Name)); 
    Response.AddHeader("Content-Length", file.Length.ToString());
    Response.ContentType = "application/octet-stream";
    Response.WriteFile(file.FullName);
    Response.End();
局限性:紧紧能下载一个文件.