CInternetSession Proxy problems

C

Chris

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!
 
J

Jack Klein

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 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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top