2
Reply

How to do Proxy Authentication

shrikant gurav

shrikant gurav

Jan 10 2008 1:36 AM
13.7k

Plz reply..

Thanks

How to make Proxy authentication in MFC. I use InternetSetOption method for it.But still i get ERROR_INTERNET_CONNOT_CONNECT.

in this i does not want to prompt the dialog box to take username and pwd , i do it hardcode,But i dosenot want to do this bcz every client have diff user name and pwd.What is possibility to tackle this.

Is any example for

  • Basic authentication scheme, where the user name and password are sent in cleartext to the server.
  • Challenge-response schemes, which allow for a challenge-response format.

    Thanks..

  • I am use this code , Using this code GET method will work fine but POST didnot..

    HINTERNET hOpenHandle,  hConnectHandle, hResourceHandle;
    DWORD dwError, dwErrorCode;
    
    hOpenHandle = InternetOpen("Example", 
                               INTERNET_OPEN_TYPE_PRECONFIG, 
                               NULL, NULL, 0);
    
    hConnectHandle = InternetConnect(hOpenHandle,
                                     "www.server.com", 
                                     INTERNET_INVALID_PORT_NUMBER, ..why this Invalid port is used
                                     NULL,
                                     NULL, 
                                     INTERNET_SERVICE_HTTP,
                                     0,0);
    
    hResourceHandle = HttpOpenRequest(hConnectHandle, "GET",
                                      "/premium/default.htm",
                                      NULL, NULL, NULL, 
                                      INTERNET_FLAG_KEEP_CONNECTION, 0);
    
    resend:
    
    HttpSendRequest(hResourceHandle, NULL, 0, NULL, 0);
    
    // dwErrorCode stores the error code associated with the call to
    // HttpSendRequest.  
    
    dwErrorCode = hResourceHandle ? ERROR_SUCCESS : GetLastError();
    
    dwError = InternetErrorDlg(hwnd, hResourceHandle, dwErrorCode, 
                               FLAGS_ERROR_UI_FILTER_FOR_ERRORS | 
                               FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS |
                               FLAGS_ERROR_UI_FLAGS_GENERATE_DATA,
                               NULL);
    
    if (dwError == ERROR_INTERNET_FORCE_RETRY)
        goto resend;
    
    // Insert code to read the data from the hResourceHandle
    // at this point.
    

    Answers (2)