FileInfo fi = new FileInfo(FilePath);
HttpResponse contextResponse = System.Web.HttpContext.Current.Response;
contextResponse.Clear();
contextResponse.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode("FileName", System.Text.Encoding.UTF8));
contextResponse.AddHeader("Content-Length",fi.Length.ToString());
contextResponse.ContentType = "application/octet-stream";
contextResponse.Filter.Close();
contextResponse.WriteFile(fi.FullName);
contextResponse.End();
contextResponse.Flush();
HTTP文件下载
最新推荐文章于 2024-07-22 14:12:09 发布