资讯   |   开发   |   选机中心   |   产品大全 | IBM | 惠普 | 联想 | 戴尔 | 苹果 | 神舟
更多: | 华硕 | 明基 | 方正 | 紫光 | TCL | 夏新 | 联宝 | 宏碁 | 七喜 | 长城 | 清华同方 | 海尔 | 三星 | 东芝 | 索尼 | 富士通 | LG | 技术 | ddnoon
当前位置:笔记本 > 软件开发 >
Advertisement
文章正文

在线等待,求助关于下载的问题

类型:转载   责任编辑:asp.net   日期:2007/05/23


热门软件下载:


   

求关于在ASP.net中下载指定文件夹下所有文件到客户端的代码(VB.net语法实现)

网友回答:

发表者:goody9807

string   path   =   Server.MapPath(this.xlfile.Text+".xls");  
   
  System.IO.FileInfo   file   =   new   System.IO.FileInfo(path);  
  Response.Clear();  
  Response.Charset="GB2312";  
  Response.ContentEncoding=System.Text.Encoding.UTF8;  
  //   添加头信息,为"文件下载/另存为"对话框指定默认文件名  
  Response.AddHeader("Content-Disposition",   "attachment;   filename="   +   Server.UrlEncode(file.Name));  
  //   添加头信息,指定文件大小,让浏览器能够显示下载进度  
  Response.AddHeader("Content-Length",   file.Length.ToString());  
   
  //   指定返回的是一个不能被客户端读取的流,必须被下载  
  Response.ContentType   =   "application/ms-excel";  
   
  //   把文件流发送到客户端  
  Response.WriteFile(file.FullName);  
  //   停止页面的执行  
   
  Response.End();


 

 
热门推荐笔记本: IBM笔记本
相关文章:
webmaster:popbb@126.com   最佳浏览:1024X768 MSIE
©2007 popbb.net All Rights Reserved