Reputation: 2673
I've enabled windows ftp in IIS 7 and able to connect through ftp://user:password@RBDRMSNMVM01
. However I tried the same through below C# snipet but I could not able to transfer the file.
It was failed at GetRequestStream() method call, which was saying "Unable to connect to the remote server"
strUserName = FTP Windows Server login user id
strPwd = FTP Windows Server login password
FtpWebRequest request = null;
FileStream fs = null;
Stream reqStream = null;
request = (FtpWebRequest)FtpWebRequest.Create(strFTPConnString);
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential(strUserName, strPwd);
reqStream = request.GetRequestStream();
reqStream.Write(buffer, 0, buffer.Length);
reqStream.Close();
Any help would be greatly appreciated !!!
Upvotes: 0
Views: 2176
Reputation: 71
Please Check whether strFTPConnString has the correct server address.
Also check if ports are being blocked by firewall.
Upvotes: 1