The remote server returned an error: 227 Entering Passive Mode ()
<p>I am doing code which uploads file from one server to another, Following is my code:</p>

<pre><code>      string CompleteDPath = "ftp://ExampleURL/photos/";
        string UName = "USerName";
        string PWD = "Password";
        WebRequest reqObj = WebRequest.Create(CompleteDPath + fileName);
        reqObj.Method = WebRequestMethods.Ftp.UploadFile;
        reqObj.Credentials = new NetworkCredential(UName, PWD);
        FileStream streamObj = System.IO.File.OpenRead(Server.MapPath(path));
        byte[] buffer = new byte[streamObj.Length + 1];
        streamObj.Read(buffer, 0, buffer.Length);
        streamObj.Close();
        streamObj = null;
        reqObj.GetRequestStream().Write(buffer, 0, buffer.Length);
        reqObj = null;
</code></pre>

<p>But first time it works fine, but next time it throws error as bellow:
The remote server returned an error: 227 Entering Passive Mode ()</p>

<p>Can you please tell me whats wrong with this.</p>
