CInternetSession Proxy problems

Discussion in 'C++' started by Chris, Jan 29, 2004.

  1. Chris

    Chris Guest

    Hello,

    I have a program that uses the CInternetSession and CHttpConnection
    mfc classes to register the program...it works for the majority of our
    customers, but a few have received errors, all of whom are going
    through proxy servers. Specifically, we have encountered a 400 error,
    a 500 error, and a 12152 error. On the 500, we have noticed that part
    of the url is appended to the sendstring twice, but have no idea why.
    Is there anyone out there who has experience with proxies that could
    shed some light on these errors? I believe that they could be fixed by
    editing the proxy settings, but we deal with many school districts as
    our customers and do not have access to the proxies. It would be best
    if we could harden our code so that these problems are resolved.


    here is a sample of the code we use:

    CInternetSession* session;
    CHttpConnection* pHttpconnection;
    CHttpFile* pFile;

    session=new CInternetSession();
    try
    {
    pHttpconnection = session->GetHttpConnection((LPCTSTR)m_sURL);
    }
    catch(CInternetException *pCause)
    {
    dwRet=pCause->m_dwError;
    errorMsg.Format(_T("Could not get connection to Web Server. Check your
    high speed or dial up connection. Error: #%u."), dwRet );
    MessageBox((LPCTSTR)errorMsg,_T("Registration Problem"));
    session->Close();
    delete session;
    return(FALSE);
    }

    try
    {
    pFile = pHttpconnection->OpenRequest(_T("GET"
    ),sSendString,NULL,1,NULL,NULL,INTERNET_FLAG_KEEP_
    CONNECTION);
    }
    catch(CInternetException *pCause)
    {
    dwRet=pCause->m_dwError;
    errorMsg.Format(_T("Could not open request to Web Server. Try again
    later. Error: #%u."), dwRet );
    MessageBox((LPCTSTR)errorMsg,_T("Registration Problem"));
    session->Close();
    delete session;
    pFile->Close();
    delete pFile ;
    return(FALSE);
    }

    dwRet = HTTP_STATUS_OK;
    try
    {
    pFile->SendRequest();
    }
    catch(CInternetException *pCause)
    {
    dwRet=pCause->m_dwError;
    errorMsg.Format(_T("Could not get send request to Web Server. Check
    your high speed or dial up connection. Error: #%u."), dwRet );
    MessageBox((LPCTSTR)errorMsg,_T("Registration Problem"));
    pHttpconnection->Close();
    delete pHttpconnection;
    session->Close();
    delete session;
    pFile->Close();
    delete pFile ;
    return(FALSE);
    }
    pFile->QueryInfoStatusCode(dwRet);


    an example of m_sURL: "webservice.ourdomain.com"
    and of the sendstring:
    "/webservicefolder/default.asmx/ProcessReq?clientXMLString=<*data*>"


    Thank you very much for any help!
     
    Chris, Jan 29, 2004
    #1
    1. Advertising

  2. Chris

    Jack Klein Guest

    On 29 Jan 2004 15:40:56 -0800, (Chris) wrote in
    comp.lang.c++:

    > Hello,
    >
    > I have a program that uses the CInternetSession and CHttpConnection
    > mfc classes to register the program...it works for the majority of our


    [snip]

    Then you need to ask in a group that supports MFC, perhaps one in one
    of the news:microsoft.public.* family. We discuss the C++ language
    here, not Microsoft or any other non-standard extensions, so this is
    not a language question. C++ itself does not have MFC,
    CInternetSession, or the other things you asked about.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++
    http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
     
    Jack Klein, Jan 30, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vidy5300
    Replies:
    0
    Views:
    914
    vidy5300
    Jun 7, 2004
  2. Replies:
    1
    Views:
    385
    Victor Bazarov
    Jun 20, 2006
  3. Replies:
    0
    Views:
    1,666
  4. Karsten Wutzke
    Replies:
    1
    Views:
    916
    Steven Simpson
    Aug 20, 2007
  5. Klein Stéphane
    Replies:
    3
    Views:
    619
    Steve Holden
    Dec 20, 2009
Loading...

Share This Page