Proxy Authentication error


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Proxy Authentication error

  1. #1
    Join Date
    May 2004
    Posts
    242

    Proxy Authentication error

    Hello everyone,



    I have a connection made to the internet :-

    CInternetSession session;
    session.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 1000);
    session.SetOption(INTERNET_OPTION_CONNECT_RETRIES, 3);

    try
    {
    remoteFile = session.OpenURL(urlPath, 1 ,
    INTERNET_FLAG_TRANSFER_BINARY |
    INTERNET_FLAG_RELOAD |
    INTERNET_OPEN_TYPE_DIRECT );

    }
    catch (CInternetException)
    {
    AfxMessageBox("Received Exception from OpenURL()");
    // Handle exception
    }

    This all works fine, and then I wish to download the file using :-

    if (remoteFile == NULL)
    {
    cout << "Error in OpenURL";
    }
    else
    {
    cout << "Ok in OpenURL";
    // Read from file

    while (nBytesRead = remoteFile->Read(inBuf, sizeof(inBuf)))
    {
    ...
    }

    When I run the software at home all works fine and the file (Excel) is downloaded successfully.

    However, at work I'm getting Proxy Authentication error, i.e. the software cannot go out through the gateway.

    The Windows Administrator tells me that if I can type the URL in IE browser and a pop-up comes up with Save As, Open etc, and later the file is downloading, then it must be my process. However, as I said this works at home ok.

    Also, I should mention that when I use the same process at work (or home) to point to URLs ending with .html (obviously no dialog boxes appear), then all ok.

    FYI: whether I try to download the file manually or using the automated process - in both cases I'm logged to the server as the same user who has permissions to download files from the Internet.

    Any ideas what it might be ? Is OpenURL, or remoteFile->Read works differently from html to Excel files ?

    Many thanks.
    Last edited by ami; 09-06-2009 at 02:02 PM.

  2. #2
    Join Date
    Jan 2005
    Location
    UK
    Posts
    604
    you need to also give your proxy username and proxy password to your call
    CHttpConnection* GetHttpConnection(
    LPCTSTR pstrServer,
    INTERNET_PORT nPort = INTERNET_INVALID_PORT_NUMBER,
    LPCTSTR pstrUserName = NULL,
    LPCTSTR pstrPassword = NULL
    );
    http://msdn.microsoft.com/en-us/libr...8VS.80%29.aspx

    Your browser might be configured to take this automatically...
    DKyb
    -------------------------------
    Life is a short warm moment -
    Death is the long cold rest.
    Pink Floyd
    -------------------------------

Similar Threads

  1. Error when exporting application proxy for DCOM
    By vrijdag in forum VB Classic
    Replies: 0
    Last Post: 12-30-2006, 05:43 AM
  2. Returning errors from SQL Server Stored Procs
    By Khalizan in forum VB Classic
    Replies: 1
    Last Post: 11-28-2001, 01:32 AM
  3. NullPointerException when reading text file
    By Andrew McLellan in forum Java
    Replies: 3
    Last Post: 05-09-2001, 05:34 PM
  4. Winsock32, Connect fails to connect to a peer
    By Chris.G in forum VB Classic
    Replies: 4
    Last Post: 11-13-2000, 03:16 PM
  5. Sample Sites.
    By Murray Foxcroft in forum Web
    Replies: 5
    Last Post: 11-02-2000, 02:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center