Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - http authentication

Reply
 
Old 09-24-2009   #1 (permalink)
James


 
 

http authentication

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

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Event ID 15016 — HTTP Service Authentication/please HELP! Vista General
Asking for authentication Vista mail
Unable to connect Outlook 2003 using HTTP authentication on Vista Vista General
Authentication over VPN Vista account administration


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46