rahulpats
February 2, 2001, 03:49 am
Hi e'body
I am writing an application in VC++ to get connect to the resin server by using the Internet Connection API CInternetSession of <afxinet.h>. But I also had to authenticate the proxy server which is set in the Internet LAN Connection.
I can get connect connect directly to the net by CInternetSession *pSession = new CInternetSession();
But I am struck up in getting connect via proxy Please Look at the code
CInternetSession* pInternetSession;
pInternetSession = new CInternetSession(_T("http"),1,INTERNET_OPEN_TYPE_PROXY,"http://192.168.1.2:8888",NULL,1);
if(!pInternetSession)
{
AfxMessageBox("Could not establish Internet Session",MB_OK);
return;
}
CString szContent;
char strProxyList[MAX_PATH], strUsername[64], strPassword[64];
strcpy(strProxyList, "192.168.1.2:8888");
strcpy(strUsername, "reuban");
strcpy(strPassword, "reuban");
CHttpConnection* pConnection;
CHttpFile* pHttpFile = NULL;
pConnection = pInternetSession->GetHttpConnection(szServer,
INTERNET_FLAG_KEEP_CONNECTION,INTERNET_INVALID_POR T_NUMBER,NULL,NULL);
pHttpFile = pConnection->OpenRequest("GET", szObject,NULL, 0, NULL, NULL,
INTERNET_FLAG_KEEP_CONNECTION);
INTERNET_PROXY_INFO proxyinfo;
proxyinfo.dwAccessType = NET_OPEN_TYPE_PROXY;
proxyinfo.lpszProxy = strProxyList;
proxyinfo.lpszProxyBypass = NULL;
pInternetSession->SetOption(INTERNET_OPTION_PROXY, (LPVOID)&proxyinfo, sizeof(INTERNET_PROXY_INFO));
pInternetSession->SetOption(INTERNET_OPTION_PROXY_USERNAME, strUsername, strlen(strUsername)+1);
pInternetSession->SetOption(INTERNET_OPTION_PROXY_PASSWORD, strPassword, strlen(strPassword)+1);
It will be greatly useful to me if u help me out of this situation.
Thanks.
Regards
rahul
rahul@myzus.com
------------------
Rahul Patil
Software developer
Myzus Infotech (P) Ltd.
Hiranandani Powai, Mumbai 76.
I am writing an application in VC++ to get connect to the resin server by using the Internet Connection API CInternetSession of <afxinet.h>. But I also had to authenticate the proxy server which is set in the Internet LAN Connection.
I can get connect connect directly to the net by CInternetSession *pSession = new CInternetSession();
But I am struck up in getting connect via proxy Please Look at the code
CInternetSession* pInternetSession;
pInternetSession = new CInternetSession(_T("http"),1,INTERNET_OPEN_TYPE_PROXY,"http://192.168.1.2:8888",NULL,1);
if(!pInternetSession)
{
AfxMessageBox("Could not establish Internet Session",MB_OK);
return;
}
CString szContent;
char strProxyList[MAX_PATH], strUsername[64], strPassword[64];
strcpy(strProxyList, "192.168.1.2:8888");
strcpy(strUsername, "reuban");
strcpy(strPassword, "reuban");
CHttpConnection* pConnection;
CHttpFile* pHttpFile = NULL;
pConnection = pInternetSession->GetHttpConnection(szServer,
INTERNET_FLAG_KEEP_CONNECTION,INTERNET_INVALID_POR T_NUMBER,NULL,NULL);
pHttpFile = pConnection->OpenRequest("GET", szObject,NULL, 0, NULL, NULL,
INTERNET_FLAG_KEEP_CONNECTION);
INTERNET_PROXY_INFO proxyinfo;
proxyinfo.dwAccessType = NET_OPEN_TYPE_PROXY;
proxyinfo.lpszProxy = strProxyList;
proxyinfo.lpszProxyBypass = NULL;
pInternetSession->SetOption(INTERNET_OPTION_PROXY, (LPVOID)&proxyinfo, sizeof(INTERNET_PROXY_INFO));
pInternetSession->SetOption(INTERNET_OPTION_PROXY_USERNAME, strUsername, strlen(strUsername)+1);
pInternetSession->SetOption(INTERNET_OPTION_PROXY_PASSWORD, strPassword, strlen(strPassword)+1);
It will be greatly useful to me if u help me out of this situation.
Thanks.
Regards
rahul
rahul@myzus.com
------------------
Rahul Patil
Software developer
Myzus Infotech (P) Ltd.
Hiranandani Powai, Mumbai 76.