Próbuję użyć ftpWebRequest wC# mój kod jestużyciu ftpWebRequest z błędem: zdalny serwer zwrócił błąd 530 nie zalogowany
// Get the object used to communicate with the server.
FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://192.168.20.10/file.txt");
request.Method = WebRequestMethods.Ftp.UploadFile;
// This example assumes the FTP site uses anonymous logon.
request.Credentials = new NetworkCredential("dev\ftp", "devftp");
// Copy the contents of the file to the request stream.
StreamReader sourceStream = new StreamReader(@"\file.txt");
byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
sourceStream.Close();
request.ContentLength = fileContents.Length;
request.UsePassive = true;
Stream requestStream = request.GetRequestStream();
requestStream.Write(fileContents, 0, fileContents.Length);
requestStream.Close();
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
Console.WriteLine("Upload File Complete, status {0}", response.StatusDescription);
response.Close();
i dostaję błąd w request.GetRequestStream(); Błąd jest następujący: serwer zdalny zwrócił błąd 530 niezalogowany jeśli próbuję wejść na stronę przeglądarki iw url, piszę ftp://192.168.20.10/ , strona brwi pyta mnie o imię i hasło, podaję to samo imię i hasło i widzę wszystkie pliki i foldery w folderze ftp.
To działało! Dzięki – user5071155