/// <summary> /// 以二进制下载文件 /// </summary> public void Download(string sFileName, string sSaveFileName) { FileInfo file= new FileInfo(sFileName);
Response.Clear(); Response.ClearHeaders(); Response.Buffer = false; Response.ContentType = "application/octet-stream"; Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(sSaveFileName, Encoding.UTF8)); Response.AppendHeader("Content-Length", file.Length.ToString()); Response.WriteFile(file.FullName); Response.Flush(); Response.End(); }
|
请发表评论