Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
06-26-2013, 02:54 PM #1
- Join Date
- Jun 2013
- Thanked 0 Times in 0 Posts
Requesting an image from a site that requires user and password
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?
06-27-2013, 07:54 PM #2
Are you talking about windows authentication? Or a site that uses a web page for logging in?
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.