[英]'throwing CInternetException for error 12005'
I keep getting "throwing CInternetException for error 12005" 我不断收到“错误12005引发CInternetException”
According to this , my URL is invalid. 根据这个 ,我的网址是无效的。 However the URL is correct and i am able to access this SharePoint site. 但是,URL是正确的,我能够访问此SharePoint网站。
I am not sure what is wrong, here is my code: 我不确定出什么问题,这是我的代码:
(the error occurs at pFile->SendRequest();
) (错误发生在pFile->SendRequest();
)
void CUserPassDiag::Connect(){
CInternetSession session(_T("My Session"));
CHttpConnection* pServer = NULL;
CHttpFile* pFile = NULL;
try
{
CString strServerName = _T("http://collaboration.unc.ca");
CString headers = "Content-Type: application/x-www-form-urlencoded\r\n";
headers += "Host: xcollaboration.pwc.ca\r\n";
headers += "Method: POST\r\n";
headers += "Pragma: no-cache\r\n";
headers += "Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, *//*r\n";
CString szHeaders = _T("%s",headers);
//To Be Send
CString strFormData = _T("action=setCameraSetting&videoOverlay.useTimestamp=1&videoOverlay.useText=1&videoOverlay.displayString=12.12-77.32");
DWORD dwRet;
CString strObject = _T("/team/T5342DFG/SitePages/UNCHome.aspx");
pServer = session.GetHttpConnection(strServerName, INTERNET_DEFAULT_HTTP_PORT, _T(""), _T(""));
pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_POST, strObject);
pFile->AddRequestHeaders(szHeaders);
pFile->SendRequest();
pFile->QueryInfoStatusCode(dwRet);
TRACE("%d",dwRet);
delete pFile;
delete pServer;
}catch(CInternetException* e){
TCHAR sz[1024];
e->GetErrorMessage(sz,1024);
_tprintf_s(_T("ERROR! %s\n"), sz);
e->Delete();
}
session.Close();
}
服务器名称( strServerName
)不应包含http://
前缀-它应该只是服务器的域名(或IP地址)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.