1

I wrote the following code to get the innerHTML text of a website:

Public Function GetInnerHtmlBody(ByVal Url As String) As HTMLDocument
    Dim ResponseDocument As New HTMLDocument

    Dim MyRequest As New WinHttpRequest
    With MyRequest
        .SetTimeouts 5000, 5000, 5000, 5000
        .SetProxy HTTPREQUEST_PROXYSETTING_PROXY, "<PROXY_SERVER_IP>:<PORT>", "*.domain.com"

        .Open "GET", Url, False

        '// Authentication for the proxy server
        '.SetCredentials "<USERNAME>", "<PASSWORD>", CREDENTIALS_FOR_PROXY

        .Send

        '// Debug
        MsgBox .ResponseText, vbInformation, .StatusText & " - " & .Status

        ResponseDocument.body.innerHTML = .ResponseText
    End With

    Set GetInnerHtmlBody = ResponseDocument
End Function

As you can see the line .SetCredentials is commented out. This line was only needed once to authenticate with the proxy server but now it seems like the login credentials were saved, because even if i exlude the row the code successfully retrieves the html code of the given website.

I restartet my computer and cleared the whole IE cache but the code still works.

  1. My question is now where are the Credentials saved? Coockie?

  2. Is there a way that the HttpRequest uses the IE proxy settings? -> No need of asking for Username and Password.

FireEmerald
  • 1,002
  • 12
  • 21
  • If you don't set a proxy the system default is used IIRC. Are the credentials in the windows store? `cmdkey /list` – Alex K. Nov 27 '14 at 14:14
  • `cmdkey /list` is empty. I tryed to use the system default proxy before i entered the credentials but it doesn't work. The proxy settings are "normally" coming from a *.pac file which is configured to use in the IE -> Settings -> Connection -> LAN -> Script. – FireEmerald Nov 27 '14 at 14:57
  • (trying to think outside the box) Is it possible that the session is saved server-side? – SierraOscar Nov 27 '14 at 23:27
  • @SO i don't know exatly how i should confim that - but i tryed checking the GET request using fiddler: `Proxy-Connection: Keep-Alive` as well as `User-Agent: Mozilla/4.0`. – FireEmerald Nov 28 '14 at 07:02
  • Have you checked the Credentials store for the calling user? – Alexander Powolozki Feb 13 '20 at 14:38

0 Answers0