C#服务端的上传和下载问题 c#uploaddownload服务端上传下载 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 参见:http://blog.csdn.net/duanzi_peng/article/details/19037777 服务器端下载文件protected void dFile() { //判断是否选择文件名 if (LisBoxFile.SelectedValue != "") { if (Session["txt"] != "") { //获取文件路径 string path = Server.MapPath("File/") + Session["txt"].ToString(); //初始化 FileInfo 类的实例,它作为文件路径的包装 FileInfo fi = new FileInfo(path); //判断文件是否存在 if (fi.Exists) { //将文件保存到本机上 Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(fi.Name)); Response.AddHeader("Content-Length", fi.Length.ToString()); Response.ContentType = "application/octet-stream"; Response.Filter.Close(); Response.WriteFile(fi.FullName); Response.End(); } } } else { Page.RegisterStartupScript("sb", "<script>alert('请您先选择文件名')</script>"); } } 干货来了,可能要付出一点小的代价,值不值自己衡量~http://download.csdn.net/detail/chenandczh/3661723 下载类很多,http://www.cnblogs.com/wang726zq/archive/2012/07/30/ftp.html 请教一下这种效果怎么实现 C# 动态创建lable textbox的问题 一个极度菜鸟的问题,大侠们别骂我 求正则表达式 如何判断DEMO的版本!! COM组件使用问题 我的第一个企业网站,大伙给点意见~~ c#如何检查端口被使用了 自动提示升级功能。 在C#中怎样才能获取摄像头的视频 求一款截取gif格式的软件。 C# Windows窗体应用程序调试出错,“Windows 已在 xxx.exe 中触发一个断点……”
protected void dFile()
{
//判断是否选择文件名
if (LisBoxFile.SelectedValue != "")
{
if (Session["txt"] != "")
{ //获取文件路径
string path = Server.MapPath("File/") + Session["txt"].ToString();
//初始化 FileInfo 类的实例,它作为文件路径的包装
FileInfo fi = new FileInfo(path);
//判断文件是否存在
if (fi.Exists)
{
//将文件保存到本机上
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(fi.Name));
Response.AddHeader("Content-Length", fi.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.Filter.Close();
Response.WriteFile(fi.FullName);
Response.End();
}
}
}
else
{
Page.RegisterStartupScript("sb", "<script>alert('请您先选择文件名')</script>");
}
}
http://download.csdn.net/detail/chenandczh/3661723