asp.net读取服务器物理路径下载文件
2007-06-16 12:46
423 查看
protected void get_download(string fl_path){
try
{
string filepath = fl_path;
string filename = System.IO.Path.GetFileName(filepath);
Response.Clear();
Response.ClearHeaders();
Response.Buffer=false;
Response.ContentType = "application/octet-stream";
//Response.ContentEncoding=System.Text.Encoding.GetEncoding("utf-8");
Response.AddHeader("Content-Disposition", "attachment; filename="+System.Web.HttpUtility.UrlEncode(filename,Encoding.UTF8));
Response.WriteFile(filepath);
Response.Flush();
Response.End();
}
catch(Exception E){
alert("没有找到您所要下载的数据!");
}
}
try
{
string filepath = fl_path;
string filename = System.IO.Path.GetFileName(filepath);
Response.Clear();
Response.ClearHeaders();
Response.Buffer=false;
Response.ContentType = "application/octet-stream";
//Response.ContentEncoding=System.Text.Encoding.GetEncoding("utf-8");
Response.AddHeader("Content-Disposition", "attachment; filename="+System.Web.HttpUtility.UrlEncode(filename,Encoding.UTF8));
Response.WriteFile(filepath);
Response.Flush();
Response.End();
}
catch(Exception E){
alert("没有找到您所要下载的数据!");
}
}
相关文章推荐
- ASP.NET获取服务器文件的物理路径
- asp.net文件压缩,下载,物理路径,相对路径,删除文件
- HttpContext是干什么的; asp.net 获取网站路径;DataSet读取xml文件;updatepanel 控件的局部刷新 always和condition
- ASP.NET 2.0 读取配置文件[INI](示例代码下载)
- ASP.NET 2.0 读取配置文件[INI](示例代码下载)
- ASP.NET实现从服务器下载文件2
- ASP.NET 2.0 读取配置文件[INI](示例代码下载)
- Asp.net Web.config文件读取路径你真的清楚吗?
- ASP.NET实现从服务器下载文件问题处理
- HttpContext是干什么的; asp.net 获取网站路径;DataSet读取xml文件;updatepanel 控件的局部刷新 always和condition
- asp.net中用FileStream类实现下载文件功能,自定义下载路径,像IE下载一样
- 设置 ASP.NET 存储当前应用程序的临时文件(生成的源、编译了的程序集等)的目录的物理路径。
- asp.net读取当前application下的txt文件路径
- Asp.net(C#)读取数据库并生成JS文件制作首页图片切换效果(附demo源码下载)
- ASP.NET中文件流的使用——下载Excle文件、文件的读取和写入
- Asp.net 中文件的下载(读取)
- ASP.NET 2.0 读取配置文件[INI](示例代码下载)
- ASP.NET文件下载简单实现(也可以通过直接读取数据库 大字段文件,如oracle 中的bolg,long raw 等大字段文件)
- 【ASP.NET】获取服务器文件夹内所有文件,并生成下载链接
- ASP.NET判断物理路径下是否存在某文件,如果不存在则创建