trying to FTP a file with a special character

后端 未结 2 2017
情书的邮戳
情书的邮戳 2021-01-18 15:50

I have the code:

FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(url);
request.Method = WebRequestMethods.Ftp.DownloadFile;
request.UseBinary = t         


        
相关标签:
2条回答
  • 2021-01-18 16:20

    Do a string replace with "#" ->"%23"
    URL encodings shouldn't contain a hash because:

    Some characters present the possibility of being misunderstood within URLs for various reasons. These characters should also always be encoded.

    0 讨论(0)
  • 2021-01-18 16:33

    You can use HttpUtility.UrlEncode to encode the special characters.

    0 讨论(0)
提交回复
热议问题