locked
How to connect ta a ftp server with CFtpConnection thru a proxy server RRS feed

  • Question

  • Hi,

    Im trying to connect to a ftp server thru a proxy server; here is a part of my source code:

     

    CInternetSession isServer("App name",1,INTERNET_OPEN_TYPE_PROXY, "webproxy.company.com", NULL, 0);

     

    i = isServer.SetOption(INTERNET_OPTION_PROXY_USERNAME, (LPVOID)this->proxyUserName, strlen(this->proxyUserName), 0);

     

    i = isServer.SetOption(INTERNET_OPTION_PROXY_PASSWORD, (LPVOID)this->proxyPassword, strlen(this->proxyPassword), 0);

     

    try

    {

    ftpServer = isServer.GetFtpConnection(Server,username,password,Port,NULL);

    }

    catch (CInternetException* pEx)

    ....

     

    Actually, SetOption with INTERNET_OPTION_PROXY_USERNAME and INTERNET_OPTION_PROXY_PASSWORD return false, and getLastError return 0...

    I also tried to set options manually with INTERNET_OPTION_PROXY, it return true but I got always the same errors with USERNAME and PASSWORD... When a do the GetFtpConnection, i got an exception: 12007...

    What am i doing wrong? it seems so simple...

    Thanks a lot

     

     

     

    Wednesday, June 20, 2007 4:14 PM

Answers

  • Hello,

     

    The p2p forum isn't really the right place for this kind of question.  Unfortunately, I wasn't able to find a more appropriate Microsoft forum to redirect you to.  I'd like to give it a shot though Smile

     

    First of all, what kind of proxy server are you using?  While researching this subject for you, I came upon this knowledgebase article which talks specifically about creating and using an FTP connection with a CERN-based proxy.  It goes on to explain that this kind of proxy communicates with clients using HTTP, and so you can't use the FTP set of Wininet APIs (such as GetFtpConnection)  It then shows how to use more generic network IO functions to FTP with the proxy.

     

    Please check whether your proxy server is the kind that expects traffic between itself and the clien to be HTTP only.

     

    Thanks,

    Vladimir

    Wednesday, June 20, 2007 9:46 PM

All replies

  • Hello,

     

    The p2p forum isn't really the right place for this kind of question.  Unfortunately, I wasn't able to find a more appropriate Microsoft forum to redirect you to.  I'd like to give it a shot though Smile

     

    First of all, what kind of proxy server are you using?  While researching this subject for you, I came upon this knowledgebase article which talks specifically about creating and using an FTP connection with a CERN-based proxy.  It goes on to explain that this kind of proxy communicates with clients using HTTP, and so you can't use the FTP set of Wininet APIs (such as GetFtpConnection)  It then shows how to use more generic network IO functions to FTP with the proxy.

     

    Please check whether your proxy server is the kind that expects traffic between itself and the clien to be HTTP only.

     

    Thanks,

    Vladimir

    Wednesday, June 20, 2007 9:46 PM
  • Well, that was my problem.

    I tested it and now it works!

    Thanks a lot and sorry for the wrong forum Smile

    Friday, June 22, 2007 11:51 AM
  • Hi Jeff,

    How did you solved this problem.
    Thursday, May 28, 2009 1:46 PM