0

I could see that he had to use FTP to write to, or delete or download a file on a Linux server:

https://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx

However I do not understand is how we identify the server to use. Also, I can not not understand is when specifies no server name, address.

So if someone could help me a little better now please understand.

Thanks in advance for your help.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Millet Antoine
  • 405
  • 1
  • 6
  • 24
  • 3
    Please don't ask us to explain code on another site. If their code doesn't work then contact them. This site is for when *your* code doesn't work, and you should include *your* code in the question and identify exactly what part is failing and what results you expect – musefan May 27 '16 at 08:33
  • i don't ask you question about code, I especially asked for explanations on the functioning between the FTPr and linux server connection. – Millet Antoine May 27 '16 at 08:40
  • 1
    Then your question is *too broad*, where is your attempt? Do you want us to write you a book on the subject? – musefan May 27 '16 at 08:42
  • I just want to have explanation on how we identify on a linux server in C #? with some other post on StackOverflow I have seen that it is necessary to use FTP. However I do not understand how we identify a linux server. I don't understand how the ftp will connect to a linux server if we give him no information like name of server, user, password . – Millet Antoine May 27 '16 at 08:52

1 Answers1

1

With the FtpWebRequest, you use URL to both specify the file to operate with and the server.

So if you want download a file /path/file.ext from FTP server example.com, you use a URL like:

ftp://example.com/path/file.ext

You can even include a username and password:

ftp://user:password@example.com/path/file.ext

(or you can use FtpWebRequest.Credentials property).


FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://example.com/path/file.ext");
request.Method = WebRequestMethods.Ftp.DownloadFile;

See also Upload and download a binary file to/from FTP server in C#/.NET.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • Tank you. But with the second possibilitie, where are you specify the username and password ? in the same way as the first solution ? – Millet Antoine May 27 '16 at 09:07
  • i'm sorry, it was a misunderstanding, i have done some recherche about FtpWebRequest.Credentials and i have understood. Thank you so much for you helped now i can continu my program, have a nice day. – Millet Antoine May 27 '16 at 09:29