![]() System.Net Verbose: 0 : WebRequest::Create() 90% of the time the problem with active ftp connections is that your firewall or antivirus software block the response from the server and when we don't receive it we consider the connection didn't succeed and throw an exception. I've used as much of your code as I could to make it easier for you to find the problem. This is just a sample without try-catch and any other checks to get you started. Stream respStream = response.GetResponseStream() RequestStream.Write(buffer, 0, readBytes) įtpWebResponse response = ( FtpWebResponse )request.GetResponse() ReadBytes = stream.Read(buffer, 0, bufferLength) Stream requestStream = request.GetRequestStream() īyte buffer = new byte įileStream stream = File. Request.Credentials = new NetworkCredential ( "user", "pass" ) String serverUri = ftp://yourIP/textFile.txt įtpWebRequest request = ( FtpWebRequest ) WebRequest. Note: since you're using active ftp you have to set the proxy to null. This code worked for me and I didn't get any exceptions. I tried with a simple txt file in the current directory.
0 Comments
Leave a Reply. |