protected void Page_Load(object sender, EventArgs e)
{
string filePath = Request.Params["FilePath"];
string fileName = HttpUtility.UrlDecode(Request.Params["FileName"]);
if (filePath != null)
{
DownLoad(fileName, filePath);
}
}

public void DownLoad(string FileName, string FilePath)
{
string result = string.Empty;
WebClient wc = new WebClient();
wc.BaseAddress = FilePath;
byte[] bytes;
bytes = wc.DownloadData(wc.BaseAddress);
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}", HttpUtility.UrlEncode(
FileName), System.Text.Encoding.UTF8));
MemoryStream ms = new MemoryStream(bytes); ms.WriteTo(Response.OutputStream); ms.Dispose(); ms.Close();

}

最新文章

  1. cas与NGINX整合(转)
  2. [MetaHook] Load DTX texture to OpenGL
  3. 用 BPL 封装数据连接
  4. ios专题 - 单例模式的实现
  5. <转载>构造函数与拷贝构造函数
  6. ASP.NET MVC 学习之路-3
  7. nopCommerce 3.9 大波浪系列 之 global.asax
  8. Lucene详解
  9. spring不走注解的原因
  10. angular-material(一)
  11. 图片上传预览js
  12. JS 字符ASCII转换
  13. RHEL6.2 ORACLE11G
  14. Odoo9.0模块开发全流程
  15. c++ const enum #define
  16. Fully qualified name FQCN
  17. 11.22Daily Scrum
  18. devm_xxx机制
  19. BMP文件组成
  20. HDU 1280 前m大的数(排序,字符串)

热门文章

  1. 后台封装的easyui框架,处理texbox的时候报错:未结束的字符串常量。
  2. DEDECMS 多站用一个站图片
  3. if __name__ == 'main': 的作用和原理
  4. samba实现CentOS和window上的数据同步
  5. js验证对象类型
  6. VC使用双缓冲制作绘图控件
  7. tomcat 配置细节
  8. groovy 知识集锦
  9. SpringMVC中的一些注解
  10. ubuntu单用户修改密码