如何使用c#从ftp中删除文件,必须通过代理建立连接 [英] how to delete a file from ftp using c# , the connection have to be established through proxy

查看:97
本文介绍了如何使用c#从ftp中删除文件,必须通过代理建立连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我在通过代理建立连接时遇到问题,如何使用c#从ftp删除文件,必须通过代理建立连接?





我的编码如下,



  string  fileName =   testFile.txt ; 

FtpWebRequest requestFileDelete =(FtpWebRequest)WebRequest.Create( ftp:// ... .. + fileName);
requestFileDelete.Credentials = new NetworkCredential( .... ...);
requestFileDelete.Method = WebRequestMethods.Ftp.DeleteFile;

FtpWebResponse responseFileDelete =(FtpWebResponse)requestFileDelete.GetResponse();





但是我收到以下错误:



使用HTTP代理时不支持请求的FTP命令。





请帮帮我

解决方案

简单的C#FTP类 [ ^

Hi All,

I have a problem while establishing connection through proxy, How to delete a file from ftp using c# , the connection have to be established through proxy?


My coding is as follows,

string fileName = "testFile.txt";

FtpWebRequest requestFileDelete = (FtpWebRequest)WebRequest.Create("ftp://....." + fileName);
requestFileDelete.Credentials = new NetworkCredential("....", "...");
requestFileDelete.Method = WebRequestMethods.Ftp.DeleteFile;

FtpWebResponse responseFileDelete = (FtpWebResponse)requestFileDelete.GetResponse();



But am getting the following Error:

The requested FTP command is not supported when using HTTP proxy.


Please Help me

解决方案

Simple C# FTP Class[^]


这篇关于如何使用c#从ftp中删除文件,必须通过代理建立连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆