實現的方式是通過第三方程式庫實現的,當然最主要的是開源且免費,已測試過沒有問題!

目前還沒有直接取得目錄FileInfo list的方法,不過還好可以用GetDirectoryList來取得類似的結果。

可以參考 https://ftps.codeplex.com/

public class ImplicitFtps
{
private static readonly string hostName = "199.1*3.***.**";
private static readonly string userName = "OECRT";
private static readonly string password = "****";
private static readonly int port = ; public FTPSClient Connect()
{
FTPSClient client = new FTPSClient();
client.Connect(hostName, port,
new NetworkCredential(userName, password),
ESSLSupportMode.Implicit,
new RemoteCertificateValidationCallback((a, b, c, d) => { return true; }),
null,
,
,
,
,
false,
EDataConnectionMode.Passive);
return client;
} public void UploadFile(string localFile, string remotePath)
{
using (FTPSClient client = this.Connect())
{
if (string.IsNullOrEmpty(remotePath))
remotePath = client.GetCurrentDirectory(); client.SetTransferMode(ETransferMode.Binary);
client.SetTextEncoding(ETextEncoding.UTF8);
FileInfo fileInfo = new FileInfo(localFile);
client.PutFile(localFile, System.IO.Path.Combine(remotePath, fileInfo.Name));
}
} public IList<DirectoryListItem> GetFiles()
{
using (FTPSClient client = this.Connect())
{
return client.GetDirectoryList();
}
}
}

C#隐式FTPS (Implicit FTPS)的更多相关文章

  1. 显示转换explicit和隐式转换implicit

    用户自定义的显示转换和隐式转换 显式转换implicit关键字告诉编译器,在源代码中不必做显示的转型就可以产生调用转换操作符方法的代码. 隐式转换implicit关键字告诉编译器只有当源代码中指定了显 ...

  2. C++ - 模板类模板成员函数(member function template)隐式处理(implicit)变化

    模板类模板成员函数(member function template)隐式处理(implicit)变化 本文地址: http://blog.csdn.net/caroline_wendy/articl ...

  3. [Selenium]显式等待 Explicit wait & 隐式等待 Implicit wait

    显式等待 Explicit wait 显示等待 , 就是明确的要等到某个元素出现或者某个元素满足某种条件,每隔一段时间检查一次,等不到,就一直等,如果在规定的时间内还没有找到,就跳出来检查间隔的时间和 ...

  4. Scala 隐式(implicit)详解

    文章正文 通过隐式转换,程序员可以在编写Scala程序时故意漏掉一些信息,让编译器去尝试在编译期间自动推导出这些信息来,这种特性可以极大的减少代码量,忽略那些冗长,过于细节的代码. 1.Spark 中 ...

  5. Scala之隐式转换implicit详解

    假设我们有一个表示文本的行数的类LineNumber: class LineNumber ( val num : Int ) 我们可以用这个类来表示一本书中每一页的行数: val lineNumOfP ...

  6. c++隐式转换(implicit conversion)

    1.缘由 最近在使用nlohmann的json,发现有些地方不是特别好用,所以就想自己修改一下(目的是为了增加类似jsoncpp中可以//增加注释的功能),在看源码的时候看到了一个迷惑的地方,就是解析 ...

  7. Scala中的Implicit(隐式转换,隐式参数,隐式类)

    文章来自:http://www.cnblogs.com/hark0623/p/4196452.html  转发请注明 代码如下: /** * 隐式转换 隐式参数 隐式类 */ //隐式转换 class ...

  8. C# 转换符的重载 显示、隐式转换

    class Complex { //保存转换的值 Int32 v; public Complex(Int32 x) { v = x; } public Int32 ToInt32() { return ...

  9. scala 隐式转换

    先参考这篇文章:http://www.jianshu.com/p/a344914de895 package com.test.scalaw.test /** * scala隐式转换 */ object ...

随机推荐

  1. Instantiate实例化的注意事项

    _obj= Resources.Load("xxx") as GameObject;Instantiate(_obj); 这里的_obj对象和 _obj= Instantiate( ...

  2. .com .cn .org .edu等域名的意义

    在开发的时候遇到了.org的域名,后来就去查了一下,原来这种域名是非盈利组织或者协会的标志 比如: https://getcomposer.org/ https://packagist.org/ ht ...

  3. pytest命令行选项

    -m 标记 代码加一个装饰器:@pytest.mark.run_bbc_test,命令行添加 -m run_bbc_test,执行带@pytest.mark.run_bbc_test的测试用例: -k ...

  4. Java-Runoob-高级教程:Java 9 新特性

    ylbtech-Java-Runoob-高级教程:Java 9 新特性 1.返回顶部 1. Java 9 新特性 Java 9 发布于 2017 年 9 月 22 日,带来了很多新特性,其中最主要的变 ...

  5. Centos 6.5 安装Oracle 11g R2 on vbox

    由于上一篇的rac安装,截图较多,这一篇选择以txt的方式叙述,另外上一篇的时间比较久远,这里最近从新安装 --2018-10-29 1 os环境初始化 [root@rac1 yum.repos.d] ...

  6. python签名设计

    将一个签名网站http://www.uustv.com/的内容爬下来显示出来 代码:sign.py from tkinter import * from tkinter import messageb ...

  7. JS播放声音 兼容所有浏览器

    JS播放声音 兼容所有浏览器 <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http ...

  8. leetcode375

    public class Solution { public int GetMoneyAmount(int n) { , n + ]; , n); } int DP(int[,] t, int s, ...

  9. sendMail在centos下的安装

    一.sendEmail介绍   SendEmail is a lightweight, command line SMTP email client. If you have the need to ...

  10. jqurey datatable tableTools 自定义button元素 以及按钮定义事件

    版本 1.10.4 "dom": 'T<"clear">lfrtip', "tableTools": { //"sSw ...