////// 从服务器下载文件 /// /// 文件地址 private void DownloadFile(string FileUri) { FileInfo fi = new FileInfo(FileUri); Response.Clear(); Response.ClearHeaders(); Response.Buffer = false; Response.ContentType = "application/octet-stream"; Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fi.FullName, System.Text.Encoding.UTF8)); Response.AppendHeader("Content-Length", fi.Length.ToString()); Response.WriteFile(fi.FullName); Response.Flush(); Response.End(); }
其中地址为绝对路径。