久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 TLS 會話重用將文件上傳到 C# 中的隱式 FTP

Upload file to implicit FTPS server in C# with TLS session reuse(使用 TLS 會話重用將文件上傳到 C# 中的隱式 FTPS 服務器)
本文介紹了使用 TLS 會話重用將文件上傳到 C# 中的隱式 FTPS 服務器的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我正在嘗試使用 TLS 協議通過 ftps 將文件上傳到 FileZilla 服務器.服務器上的 20 和 21 端口已關閉.我設法連接到服務器的唯一方法是使用 FluentFTP,但由于某些 FileZilla 服務器錯誤,我無法上傳文件.

有什么辦法可以避免違反安全級別?如果沒有,是否還有其他免費庫支持使用 TLS/SSL 上傳文件?我也試過這個,但沒有用.
https://docs.microsoft.com/en-us/dotnet/api/system.net.ftpwebrequest.enablessl

謝謝.

解決方案

你可以使用 WinSCP .NET 程序集.

它支持隱式 TLS(端口 990).并且使用 OpenSSL TLS 實現(不是 .NET Framework),所以應該沒有 FluentFTP 的問題.它對我來說絕對適用于 FileZilla FTP 服務器,即使打開了會話恢復要求.

SessionOptions sessionOptions = new SessionOptions{協議 = Protocol.Ftp,主機名 = ftp.example.com",用戶名 = 用戶名",密碼=密碼",FtpSecure = FtpSecure.Implicit,TlsHostCertificateFingerprint = "xx:xx:xx:...",};使用(會話會話 = 新會話()){session.Open(sessionOptions);session.PutFiles(localPath, remotePath).Check();}

(我是 WinSCP 的作者)

有關該問題的更多參考,另請參閱可以使用 FileZilla 或 WinSCP 連接到 FTP,但不能使用 FtpWebRequest 或 FluentFTP.

I'm trying to upload file to FileZilla server through ftps by protocol TLS. On the server port 20 and 21 is closed. The only way how I managed to connect to server is by using FluentFTP but I couldn't upload file because of some FileZilla server bug.

https://github.com/robinrodricks/FluentFTP/issues/335
https://forum.filezilla-project.org/viewtopic.php?t=51601

public static void UploadTest(
    string pathUploadFile, string addressIP, int port, string location,
    string userName, string password)
{
    FtpClient ftp;

    Console.WriteLine("Configuring FTP to Connect to {0}", addressIP);
    ftp = new FtpClient(addressIP, port, new NetworkCredential(userName, password));
    ftp.ConnectTimeout = 600000;
    ftp.ReadTimeout = 60000;
    ftp.EncryptionMode = FtpEncryptionMode.Implicit;
    ftp.SslProtocols = SslProtocols.Default | SslProtocols.Tls11 | SslProtocols.Tls12;
    ftp.ValidateCertificate += new FtpSslValidation(OnValidateCertificate);
    ftp.Connect();
    // upload a file
    ftp.UploadFile(pathUploadFile, location);

    Console.WriteLine("Connected to {0}", addressIP);
    ftp.Disconnect();

    void OnValidateCertificate(FtpClient control, FtpSslValidationEventArgs e)
    {
        // add logic to test if certificate is valid here
        e.Accept = true;
    }
}

Is there any way around without a violating security level? If not is there any other free library which support uploading files with TLS/SSL? I also tried this but it didn't work.
https://docs.microsoft.com/en-us/dotnet/api/system.net.ftpwebrequest.enablessl

Thanks.

解決方案

You can use WinSCP .NET assembly.

It supports implicit TLS (port 990). And uses OpenSSL TLS implementation (not .NET Framework), so it should not have the problem that FluentFTP has. It definitely works for me against FileZilla FTP server, even with session resumption requirement turned on.

SessionOptions sessionOptions = new SessionOptions
{
    Protocol = Protocol.Ftp,
    HostName = "ftp.example.com",
    UserName = "username",
    Password = "password",
    FtpSecure = FtpSecure.Implicit,
    TlsHostCertificateFingerprint = "xx:xx:xx:...",
};

using (Session session = new Session())
{
    session.Open(sessionOptions);

    session.PutFiles(localPath, remotePath).Check();
}

(I'm the author of WinSCP)

For more references about the problem, see also Can connect to FTP using FileZilla or WinSCP, but not with FtpWebRequest or FluentFTP.

這篇關于使用 TLS 會話重用將文件上傳到 C# 中的隱式 FTPS 服務器的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

ASP.NET Core authenticating with Azure Active Directory and persisting custom Claims across requests(ASP.NET Core 使用 Azure Active Directory 進行身份驗證并跨請求保留自定義聲明)
ASP.NET Core 2.0 Web API Azure Ad v2 Token Authorization not working(ASP.NET Core 2.0 Web API Azure Ad v2 令牌授權不起作用)
ASP Core Azure Active Directory Login use roles(ASP Core Azure Active Directory 登錄使用角色)
How do I get Azure AD OAuth2 Access Token and Refresh token for Daemon or Server to C# ASP.NET Web API(如何獲取守護進程或服務器到 C# ASP.NET Web API 的 Azure AD OAuth2 訪問令牌和刷新令牌) - IT屋-程序員軟件開發技
.Net Core 2.0 - Get AAD access token to use with Microsoft Graph(.Net Core 2.0 - 獲取 AAD 訪問令牌以與 Microsoft Graph 一起使用)
Azure KeyVault Active Directory AcquireTokenAsync timeout when called asynchronously(異步調用時 Azure KeyVault Active Directory AcquireTokenAsync 超時)
主站蜘蛛池模板: a久久| 91秦先生艺校小琴 | 狠狠操婷婷 | 精品日韩欧美一区二区 | 毛片一区二区三区 | 久操伊人 | 粉嫩av久久一区二区三区 | 青青草av网站 | 在线观看视频亚洲 | av男人的天堂在线 | 午夜精品一区二区三区在线观看 | 奇色影视 | 国产精品国产 | 亚洲精品一区二区三区蜜桃久 | 亚洲精品乱码久久久久久黑人 | 日韩精品一区二区三区在线 | 羞羞视频在线观免费观看 | 91精品国产高清一区二区三区 | 欧美激情在线一区二区三区 | 少妇特黄a一区二区三区88av | 国产精品日韩一区二区 | 男女污网站 | 另类视频区 | av在线天堂 | 亚洲成人精 | av网站在线免费观看 | 国产一区二区在线视频 | 免费看国产a | 99re在线视频免费观看 | 免费成人高清 | 欧美精品99| 成人一区精品 | 欧美精品成人 | 国产精品久久九九 | 国产精品久久久久久妇女 | 成人久久一区 | 91av在线免费播放 | 国产免费让你躁在线视频 | 欧美精品网 | 国产一区二区三区视频在线观看 | 精品伊人久久 |