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-09-04 20:11:15 发布
1831





