在 VC 中使用 WinInet  执行服务器端ASP 程序,并且得到ASP 执行后的结果,例如:ASP 生成一个 XML 文件内容,使用 WININET 得到这个内容。最好是源码,如能解决,另有高分相赠。非常感谢。提供思路的朋友也有分。

解决方案 »

  1.   

    本人正在作的一个项目就是要实现你所说的功能,在客户端运行一个程序,得到服务器端的ASP程序执行的结果,可以给你看看,没有加纠错功能哦!自己补上吧。
    CString SendData(/*LPMEMBERINFO pMemberInfo, CFile myFile*/)//get data(now is time of server) from server and send the member's info to the server
    {
            CString strURL = "http://127.0.0.1/a.asp";

    TCHAR strReceive[128];
    CInternetSession *pSession;
    CHttpConnection* pServer = NULL;
    CHttpFile* pFile = NULL;
        
    try
    {
    CString strServerName = _T ("http://127.0.0.1");
    CString strObject = _T ("/a.asp");
    INTERNET_PORT nPort = 80;
          DWORD dwServiceType = AFX_INET_SERVICE_HTTP;  
        if (!AfxParseURL(strURL, dwServiceType, 
    strServerName, 
    strObject, nPort))
    {
    TRACE0("Error");
                }

    //创建Internet会话
        pSession=new CInternetSession(NULL, 1, PRE_CONFIG_INTERNET_ACCESS);            CString szHeaders = "Accept: text//*";

        pServer = pSession->GetHttpConnection(strServerName, nPort);     DWORD dwHttpRequestFlags = 
    INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;     pFile = pServer->OpenRequest (CHttpConnection::HTTP_VERB_GET,
    strObject, NULL, 1, NULL, NULL, dwHttpRequestFlags);
                
    pFile->AddRequestHeaders (szHeaders);
                 
        pFile->SendRequest();
                
    pFile->ReadString(strReceive, 128); 
    //pFile->QueryInfoStatusCode(dwRet);
        //pFile->WriteString(g_cstInfo);
        //pFile->EndRequest();
    //CHttpFile* pF = (CHttpFile*)pSession.OpenURL("http:\\\\10.190.11.239", 1, INTERNET_FLAG_TRANSFER_ASCII, g_cstInfo, g_cstInfo.GetLength());
    //delete pSession; 
    }
    catch (CInternetException* pEx)
    {
    pFile->Close();
    delete pFile;
    pServer->Close();
    delete pServer;
    }
            pFile->Close();
    delete pFile;
    pServer->Close();
    delete pServer;
    pSession->Close();
    return strReceive;
    }
      

  2.   

    http://www.codeconduct.com/HTML/xml.asp
      

  3.   

    http://www.csdn.net/expert/topic/564/564348.xml?temp=.2239649
    http://www.csdn.net/expert/topic/609/609680.xml?temp=.3464624
      

  4.   

    http://www.csdn.net/expert/topic/564/564348.xml?temp=.2239649
    http://www.csdn.net/expert/topic/609/609680.xml?temp=.3464624
      

  5.   

    很简单
    就是POST一个一个CGI请求而已