I have a class that FTPs a file to a remote server, the code looks like this:
FtpWebRequest oFTPRequest = (FtpWebRequest)WebRequest.Create(sFTPServer + sTargetFolderAndFileName);
oFTPRequest.Method = WebRequestMethods.Ftp.UploadFile;
oFTPRequest.Credentials = new NetworkCredential(sFTPUserName, sFTPPassword);
oFTPRequest.UseBinary = true;
Stream requestStream = oFTPRequest.GetRequestStream();
// uploads file...
The all works perfectly when running from the dev environment, however when I compile and place onto the server it fails with an FTP Error "The remote server returned an error: (530) Not logged in.".
The username, password, ftp server and path information are all identical to the code running in dev environment - so I know they are correct.
The only two differences I can see are: - The code is now compiled - My (dev) PC is Windows 7 64bit and the target server is Windows 2003 32bit
All using .NET 4.0 / VS2010
Why is it working on one and not the other?