Silverlight文件下载完美版
来源:互联网 发布:域名快速备案费用 编辑:程序博客网 时间:2024/04/25 21:58
页面:hlink.NavigateUri = new Uri(ServiceHelper.BaseUrl + ServicePath.DownFilePath + "?fileName="+((Sys_AttachmentLibraryModel)selDownFile.SelectedItem).FileUrl.ToString());
服务端:DownLoadFileHandler.ashx
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.IO;public class DownLoadFileHandler : BaseService{ public override void ProcessRequest(HttpContext context) { Context = context; Result = new ActionResult(); String fileName = context.Request.QueryString["fileName"]; //客户端保存的文件名 fileName = HttpUtility.UrlDecode(fileName); String filePath = ConfigHelper.UploadPath+ fileName; //路径 FileInfo fileInfo = new FileInfo(filePath); if (fileInfo.Exists) { byte[] buffer = new byte[102400]; context.Response.Clear(); FileStream iStream = File.OpenRead(filePath); long dataLengthToRead = iStream.Length; //获取下载的文件总大小 context.Response.ContentType = "application/octet-stream"; context.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName.Substring(fileName.LastIndexOf("\\")+1), System.Text.Encoding.UTF8)); while (dataLengthToRead > 0 && context.Response.IsClientConnected) { int lengthRead = iStream.Read(buffer, 0, Convert.ToInt32(102400));//'读取的大小 context.Response.OutputStream.Write(buffer, 0, lengthRead); context.Response.Flush(); dataLengthToRead = dataLengthToRead - lengthRead; } context.Response.Close(); context.Response.End(); } // 输出结果 OutputResult(); }}
- Silverlight文件下载完美版
- Silverlight实现文件下载
- silverlight文件下载方法
- silverlight文件下载
- silverlight下载文件
- GSMS-华为应急通讯完美版 ISO文件下载
- Silverlight实现文件的下载[很简单]
- struts2完美实现文件上传和下载
- Silverlight 下载
- 华为应急通讯完美版 GSMS软件 ISO文件 百度网盘下载
- Silverlight技术研讨(1):WebClient, 文件下载利器
- 完美实现Silverlight动态加载
- 完美实现Silverlight动态加载
- 完美实现Silverlight动态加载
- 完美实现Silverlight动态加载
- 解决下载MP3等文件自动播放完美解决方法
- 完美绿色dezend本地版下载
- 《红色警戒3》简体中文完美整合版下载
- 多态Object类toString方法学习笔记ObjectDemo.java
- Building an Hadoop 0.20.x version for HBase 0.90.2
- SQL Server数据库重命名、数据导出等若干问题
- 代码重构清单
- openssl使用
- Silverlight文件下载完美版
- JS常用正则表达式
- javascript读取后台C#变量显示后乱码
- PHP autoload机制详解
- I2C上拉电阻
- <转>用HTML判断IE版本
- 熬不尽的IT江湖
- java 读文件的几种方法(一)
- _tcstok函数的使用