m_dwHttpRequestFlags= INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT; CHttpFile *pFile =m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_PUT ,
strFile, NULL, 1, NULL, NULL, m_dwHttpRequestFlags); CString strFilea;
strFilea = strFile;
try
{
pFile->SendRequest();
}
catch(CInternetException* pEx)
{
TCHAR szError[1024];
pEx->GetErrorMessage(szError,1024);
AfxMessageBox(szError);
pFile->Close();
return FALSE;
}
char buf[MAXSIZE];
DWORD dwRead=0;
UINT nBytesRead=1; DWORD dwWritten;
BOOL bRet;
strcpy(buf,"Hello,World"); bRet = InternetWriteFile(pFile,buf,5, &dwWritten);//不报错,但是写不到到文件中
//pFile->Write(buf,nBytesRead); //这句直接报错.
if(!bRet)
{
memset(buf,0,MAXSIZE);
//bRet = InternetGetLastResponseInfo( &lRet,buf,&lBuffLen);
nRet = GetLastError();
}
}
pFile->Close();
return FALSE;
strFile, NULL, 1, NULL, NULL, m_dwHttpRequestFlags); CString strFilea;
strFilea = strFile;
try
{
pFile->SendRequest();
}
catch(CInternetException* pEx)
{
TCHAR szError[1024];
pEx->GetErrorMessage(szError,1024);
AfxMessageBox(szError);
pFile->Close();
return FALSE;
}
char buf[MAXSIZE];
DWORD dwRead=0;
UINT nBytesRead=1; DWORD dwWritten;
BOOL bRet;
strcpy(buf,"Hello,World"); bRet = InternetWriteFile(pFile,buf,5, &dwWritten);//不报错,但是写不到到文件中
//pFile->Write(buf,nBytesRead); //这句直接报错.
if(!bRet)
{
memset(buf,0,MAXSIZE);
//bRet = InternetGetLastResponseInfo( &lRet,buf,&lBuffLen);
nRet = GetLastError();
}
}
pFile->Close();
return FALSE;
Valid HINTERNET handle returned from a previous call to FtpOpenFile or an HINTERNET handle sent by HttpSendRequestEx.
pFile->EndRequest();
pServer = sess.GetHttpConnection("mooseboy");
pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_POST, "/isapi.dll?");
pFile->SendRequestEx(strData.GetLength());pFile->WriteString(strData);
pFile->EndRequest();
还是只需要用登陆用户密码控制?m_pHttp=m_cis.GetHttpConnection(m_strServer,m_dwPort,"appuser","apppwd");