下载:scDirectory=Server.MapPath(".");
scFileName="test.txt";
string filePath=scDirectory+"/"+scFileName;Response.AppendHeader("Content-Disposition","attachment; filename="+HttpUtility.UrlEncode(scFileName,System.Text.Encoding.UTF8));
Response.WriteFile(filePath);
Response.End();
解决方案 »
- vs2005 GridView使用求助
- 如何让DropDownList只保留第一项,菜鸟求解答
- 运行VS2005出现的错误,请高手帮忙解决.
- 一个应该很弱智的问题,搞了一下午,未果!
- List<T> 这样写法 是不是只在C2.0 中才有?
- 水晶报表打印的时候,怎么获取客服端打印机的名字?
- 为什么我建立的虚拟目录无法访问?
- 用C#写的随机数问题
- 用户控件的引用问题!
- datetime 时间类型能否用 between time1 and time2
- 用asp.net页面用水晶报表出错!在线等!十分火急!!!!
- 一个页有两个datagrid,怎样设置当一个显示的时候,另一个隐藏,另一个显示,第一个隐藏,谢谢!
用了你的方法可以直接下载文件,但不能用FASTGET下载。不知道为什么?
然后
StreamWriter down_sw = File.CreateText(ServerDir+"list.dat");
down_sw.Write("");
down_sw.Close();
for(int m =0;m<down_tmp1.Length;m++)
{
if(down_tmp1[m]!="")
{
//创建压缩文件列表
StreamWriter down_sw2 = new StreamWriter(ServerDir+"list.dat",true,System.Text.Encoding.Default);
down_sw2.WriteLine(ServerDir+down_tmp1[m]);
down_sw2.Close();
}
}
File.Delete(ServerDir+@"upfile\manageDownLoadxxx.zip"); //删除原有的manageDownLoadxxx.zip
string down_tmp3 =@"upfile\manageDownLoadxxx.zip";
System.Diagnostics.Process Process3=new System.Diagnostics.Process();
Process3.StartInfo.FileName=ServerDir+"WinRAR.exe";
Process3.StartInfo.Arguments=" a -ep1 -inul -y "+ServerDir+down_tmp3+@" @"+ServerDir+"list.dat";
Process3.Start(); //启动压缩
while(!Process3.HasExited) //等待完成
{
}
Response.Redirect("http://"+Request.UrlReferrer.Host+ResolveUrl(down_tmp3));