最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp.net实现服务器文件下载到本地的方法
时间:2022-06-25 06:56:13 编辑:袖梨 来源:一聚教程网
1、说明
通过文件下载框实现将服务器上的文件下载到本地指定位置。这里需要指定服务器文件路径
| 代码如下 | 复制代码 |
//服务器文件路径 stringstrFilePath = Server.MapPath("~") +"/excel/20170206104654.xlsx"; FileInfo fileInfo =newFileInfo(strFilePath); Response.Clear(); Response.AddHeader("content-disposition","attachment;filename="+ Server.UrlEncode(fileInfo.Name.ToString())); Response.AddHeader("content-length", fileInfo.Length.ToString()); Response.ContentType ="application/octet-stream"; Response.ContentEncoding = System.Text.Encoding.Default; Response.WriteFile(strFilePath); | |
相关文章
- 阿里云企业邮箱官方入口在哪找-阿里云企业邮箱官网入口 02-12
- 火车票余票查询-火车票时刻表查询 02-12
- pokicon免费游戏畅玩-pokicon免费游戏一键直达 02-12
- 抖音充值-官方直充入口-家庭共享账户专享 02-12
- 磁力狗最新版本官网安装包下载-磁力狗引擎极速下载入口 02-12
- 嘀哩嘀哩无名小站怎么看-嘀哩嘀哩dilidili最新入口速递 02-12

