From: James on
I have a script to perform simple http authentication. However the
first time I run it I get this error on line 17 (objHTTP.send):

"the server returned an invalid or unrecognized response
code 80072F78
source: WinHttp:WinHttpRequest"

I run it again and it either completes successfully or I get the error:

"The data area passed to a system call is too small."

I run it a third time and it completes succesfully with "200 -ok"

I think the authentication goes through the first time but the error is
generated due to an invalid response to the script.

Can anyone suggest what changes can be made to the script so I don't get
these errors?

Const CREDENTIALS_FOR_SERVER = 0

Dim strAuthSrvr, strUser, strPass
Dim objHTTP

strAuthSrvr = "http://myserver.com"
strUser = "james"
strPass = "pass"

Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")

objHTTP.open "GET", strAuthSrvr,false

'Set credentials for server access
objHttp.SetCredentials strUser,strPass,CREDENTIALS_FOR_SERVER

objHTTP.send

WScript.Echo objHTTP.responseText
WScript.Echo objHTTP.Status & " - " & objHTTP.StatusText


Thanks,

James