문제

hi i am using the following code but it giving an error

 using (WebClient ftpClient = new WebClient())
        {
            ftpClient.Credentials = new System.Net.NetworkCredential("username", "password");
            ftpClient.DownloadFile("ftp://path.com/Business Plan.docx", "D:\\Folder\test.docx");
        }

but i am getting an error illegal characters in path.

I am not understanding how to do that.

도움이 되었습니까?

해결책

This string:

"D:\\Folder\test.docx"

Is treating the slashes ('\') as escape characters - use this instead:

@"D:\Folder\test.docx"

Or (more messy), double escape to be treated as a literal slash:

"D:\\Folder\\test.docx"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top