title: C# FTP with FtpWebRequest upload fails with "534 Policy requires SSL"
body: <p>When I try to upload files to an SFTP server it shows an error.</p>
  <p>Here is my code:</p>
  <pre><code>string fileNameOnly = Path.GetFileName(uploadingFile);
  
  FtpWebRequest request = (FtpWebRequest)WebRequest.Create(HostAddress+ &quot;/test1&quot;);
  request.Method = WebRequestMethods.Ftp.UploadFile;
  
  request.Credentials = new NetworkCredential(UserId, Password);
  
  StreamReader sourceStream = new StreamReader(@uploadingFile);
  byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
  sourceStream.Close();
  request.ContentLength = fileContents.Length;
  filesize = ConvertBytesToMegabytes(request.ContentLength);
  Console.WriteLine(&quot;hello,{0}&quot;, filesize);
  // Console.WriteLine(&quot;hellosss,{0}&quot;, request.ContentLength);
  Stream requestStream = request.GetRequestStream(); 
  Console.WriteLine(&quot;here,{0}&quot;, requestStream);
  
  requestStream.Write(fileContents, 0, fileContents.Length);
  filesizedownloaded = ConvertBytesToMegabytes(requestStream.Length);
  Console.WriteLine(&quot;hellosss,{0}&quot;, filesizedownloaded);
  worker.ReportProgress(Convert.ToInt32((Convert.ToInt32(filesizedownloaded) / filesize) * 100));
  
  requestStream.Close();
  FtpWebResponse response = (FtpWebResponse)request.GetResponse();
  FilesDetails.SelectedFileContent = &quot;&quot;;
  Console.WriteLine(&quot;Upload File Complete, status {0}&quot;, response.StatusDescription);
  MessageBox.Show(&quot;File Uploaded!&quot;, &quot; File&quot;);
  response.Close();
  </code></pre>
  <p>I get an exception at <code>Stream requestStream = request.GetRequestStream();</code></p>
  <p>The error is:</p>
  <blockquote>
  <p>Remote server returned an error: (534) 534 Policy requires SSL&quot;</p>
  </blockquote>