最新下载
热门教程
- 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); | |
相关文章
- 暗喻幻想布丽吉塔设施完工时间说明 10-31
- 三国志8重制版居民情感作用介绍说明 10-31
- 三国志8重制版游戏灾害效果介绍说明 10-31
- 三国志8重制版武将不同状态区别说明 10-31
- 三国志8重制版武将阶级提升方法分享 10-31
- 三国志8重制版武将不同阶级作用说明 10-31
 
             
                                 
                                 
                                 
                                 
                                            
                                         
                                            
                                         
                                            
                                         
                                            
                                         
                                            
                                         
                                            
                                         
                                            
                                         
                                            
                                         
                                            
                                         
                                            
                                        
