1

If I understand well, FtpWebRequest is disadvised by MS in favor of WebClient. But while uploading with Webclient I do not seem to be able to switch off binary mode. I get double linefeeds. How to prevent this with WebClient or is it better to switch to FtpWebRequest? How to deal with this?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Hans Rottier
  • 102
  • 2
  • 12

1 Answers1

2

WebClient uses (Ftp)WebRequest internally. So it is as deprecated as (Ftp)WebRequest.

The documentation of WebClient contains a similar notice as (Ftp)WebRequest:

We don't recommend that you use the WebClient class for new development. Instead, use the System.Net.Http.HttpClient class.

(disregarding the fact that the notice is about HTTP and not FTP)


That makes your question about CRLF pointless. – Either you are happy with using deprecated class, and then you can use FtpWebRequest, which supports the ASCII mode. Or you do not want to use deprecated class, and then you cannot use WebClient (which does not support the ASCII mode anyway).

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992