嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 5 元微信扫码支付:5 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
c#实现ftp上传下载(源码)。这个可以简单达到目的。-c# to achieve ftp upload and download. This can be simple to achieve their goals.
<%@ WebHandler Language="C#" Class="ftpDownload" %>
using System;
using System.Web;
public class ftpDownload : IHttpHandler
{
/// <summary>
/// ftp协议下载文件
/// </summary>
/// <param name="context"></param>
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string ftpURI = context.Request.QueryString["ftpURI"];//ftpURI
string fileName = context.Request.QueryString["fileName"];//fileName
string localPath = "C:\\";//文件下载路径(可自定义)
string errorMsg = "";
bool b = FtpWeb.Download(ftpURI, localPath, fileName, out errorMsg);
if (b)
{
context.Response.Write("ok");
}
else
{
context.Response.Write(errorMsg);
}
}
public bool IsReusable
{
get
{
return false;
}
}
}