locked
Cannot connect with ftp server with http proxy c# RRS feed

  • Question

  • I have a problem with connecting with our ftp server even if my credentials are correct.Here is how I connect my app with our FTP server.

       

    try { //Completing my proxy credentials WebProxy p = new WebProxy(); Uri newUri = new Uri("http://" + ProxyHost + ":" + ProxyPort); p.Address = newUri; p.Credentials = new NetworkCredential(ProxyUserName, DecryptProxyPassword); FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(FTPServer); ftp.Proxy = p; FtpWebResponse res; StreamReader reader; ftp.Credentials = new NetworkCredential(UserName, DecryptPassword); ftp.KeepAlive = false; ftp.Method = WebRequestMethods.Ftp.ListDirectoryDetails; ftp.UsePassive = true; ftp.UseBinary = true; ftp.KeepAlive = false; using (res = (FtpWebResponse)ftp.GetResponse()) { reader = new StreamReader(res.GetResponseStream()); MessageBox.Show("connected!"); } } catch (WebException ex) { MessageBox.Show(ex.ToString()); }

    And I receive this kind of error Message: The remote server returned an error: (503) Server Unavailable. At

    System.Net.FtpWebRequest.GetResponse()

    I've tried connecting with the use of Filezilla and it do connect using the same credentials I used in my applications.

    Please do help me out. I'm really get frustrated about it. I've tried before connecting with a filezilla server with an host

    of 127.0.0.1 it has no proxy and I'm able to connect. But with a proxy, I cant and I dont know why. What's wrong with my

    code?




    • Edited by ArolavEam Thursday, July 24, 2014 1:59 AM
    Thursday, July 24, 2014 1:57 AM