title: Cannot connect to ftp server with FtpWebRequest from Azure app
body: <p>I can upload files into azure ftp server with local asp.net app but that not works after publishing the app into azure it gives me not logged in</p>
  
  <p>Here is my code which connect to the ftp server but when deployed to azure it does not work</p>
  
  <pre><code>private void ExecuteRequest(string url, string action, string fileToUpload = null)
      {
          var request = (FtpWebRequest)WebRequest.Create(url);
          request.Method = action;
          request.UseBinary = true;
          request.UsePassive = true;
          request.KeepAlive = true;
          request.Credentials = new NetworkCredential(_settings.Username, _settings.Password);
          WebResponse response = null;
          try
          {
              if (action == WebRequestMethods.Ftp.UploadFile)
              {
                  StreamReader sourceStream = new StreamReader(fileToUpload);
                  byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
                  sourceStream.Close();
                  request.ContentLength = fileContents.Length;
  
                  Stream requestStream = request.GetRequestStream();
                  requestStream.Write(fileContents, 0, fileContents.Length);
                  requestStream.Close();
              }
              response = request.GetResponse();
          }
          catch (WebException exp)
          {
              var ftpResponse = (FtpWebResponse)exp.Response;
              if (request.Method== WebRequestMethods.Ftp.MakeDirectory &amp;&amp; ftpResponse.StatusCode != FtpStatusCode.ActionNotTakenFileUnavailable)
                  DiosException.Throw(exp);
          }
          finally
          {
              if (response != null)
                  response.Close();
          }
      }
  </code></pre>