Click here to Skip to main content
15,844,477 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
When I run the following vbscript I am getting the access denied error.
Set http = CreateObject("MSXML2.ServerXMLHTTP.6.0")
http.setTimeouts 5000, 5000, 10000, 3720000 "GET", 
http.send ""
WScript.Echo http.responseText

Error: 401:Access is denied due to invalid credentials.

What I have tried:

I have changed the line to Set http = CreateObject("MSXML2.ServerXMLHTTP.6.0") this from Set http = CreateObject("MSXML2.ServerXMLHTTP"). But still getting the same error.
Updated 20-May-16 1:35am
Mehdi Gholam 20-May-16 6:26am    
The error is pretty self explanatory, your username and password are not correct.
Staffan Bruun 20-May-16 6:27am    
The problem is not in the program itself, it's the server that won't let you access the page. Maybe you need to log on first, or provide credentials in your request?
Telstra 20-May-16 6:32am    
@Staffan..It is a server where this process runs for every 10 secs. HOw I can make sure to login to the server for every 10 secs. Is there any way to provide credetials from script itself.
ZurdoDev 20-May-16 7:46am    
Hover over the message you want to reply to and then click Reply. That way the user will be notified.
Telstra 20-May-16 6:45am    
I change the line now to "GET", "",FALSE,userName,password
On this line its showing the error as expected end of statement.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900