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?
Asked
Active
Viewed 692 times
1
Martin Prikryl
- 167,268
- 50
- 405
- 846
Hans Rottier
- 86
- 8
1 Answers
1
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
WebClientclass for new development. Instead, use the System.Net.Http.HttpClient class.
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
- 167,268
- 50
- 405
- 846
-
2HttpClient is not an FTP client so it does not relate to my question how to solve the CRLF issue. – Hans Rottier Nov 15 '19 at 08:40
-
So FtpWebRequest it will be. – Hans Rottier Nov 15 '19 at 09:12