我现在是把文件在服务器上保存着不是在虚拟目录里面保存,这是路径ftp://220.95.232.41/BVO Global Edition.exe
现在要做一个下载,让别人把我这个文件可以下载下来怎么做? 小弟谢谢了
现在要做一个下载,让别人把我这个文件可以下载下来怎么做? 小弟谢谢了
解决方案 »
- 服务器无法继续执行该事务,说明: 3700000003。此会话中的活动事务已由另外一个会话提交或终止。
- 马上要用asp.net mvc 3 开发一个CMS。但是不知道mvc 3开发出来的性能如何,请指教。
- 【求助】 后台添加button 添加事件后 点击不触发
- oracle 日期查询的问题
- 小女子急求助,页面上三个框架如何传递变量?
- 谁有图片上传服务器的例子
- .net主菜单->生成->("生成解决方案"和"生成XXX(当前项目名)")有啥区别呀?
- 求助 mvc问题
- 怎么样设置SQLserver中一时间字段(smalldatetime)默认值为当前时间(getdate())再加8小时?
- 请教关于IIS项目发布问题
- AJAX AutoCompleteExtender无反应?
- .net 2.0邮件发送失败的问题
client.DownloadFile("地址", "本地存放位置");
这样吗?
ftpwebrequest
http://topic.csdn.net/u/20100101/11/31f537a5-e615-4588-aac8-c82acf1241bb.html
/// 下载服务器文件至客户端
/// </summary>
/// <param name="url">被下载的文件地址,绝对路径</param>
/// <param name="dir">另存放的目录</param>
public void DownloadUrlFile(string url, string dir)
{
WebClient client = new WebClient();
string fileName = Path.GetFileName(url); //被下载的文件名
string path = dir + fileName; //另存为的绝对路径+文件名 try
{
if (!System.IO.Directory.Exists(dir))
{
System.IO.Directory.CreateDirectory(dir);
}
if (!System.IO.File.Exists(path))
{
client.DownloadFile(url, path);
}
}
catch (Exception)
{
// ShowError("文件下载失败!");
}
}
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode([默认下载文件名], System.Text.Encoding.UTF8));
Response.BinaryWrite([char[] buff]);//buff:文件内容
Response.Flush();
Response.End();
<body onload=" load(); ">
<form id="form1" runat="server">
<script type="text/javascript" language="javascript" >
function load() {
window.location.href = "ftp://220.95.232.41/BVO Global Edition.exe";
}
</script>
ftp://220.95.232.41/BVO Global Edition.exe 这是放在服务器上的一个文件 有时候可以下载但是有时候就不能下载 很郁闷!