I need to download an image from an URL that requires authentication.
URL = "http://192.168.10.32:8827/folder/image.png"
I have tried using "MSXML2.ServerXMLHTTP" and "WinHttp.WinHttpRequest.5.1" but I receive the same error in both cases:
"A connection with the server could not be established"
I think it's an authentication problem.
User and password are stored in variables. And they are correct.
Dim objSrvHTTP: Set http = Server.CreateObject("MSXML2.ServerXMLHTTP")
http.open "GET",url, False, user, pass
http.setRequestHeader "Authorization", "Basic " & Base64Encode(user&":"&pass)
Set req = CreateObject( "WinHttp.WinHttpRequest.5.1" )
req.Open "GET", url, False
req.SetCredentials user, , HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
Is there any other method to authenticate to a site before you proceed to download?