Answered by:
Access is denied while using Microsoft.XMLHTTP to get a URL link in vbscript. HELP!!!

Question
-
Hi,
I have a geturl.vbs file like below.
url = "http://www.google.com/"
WScript.Echo url
WScript.Echo urlget(url)
Function URLGet(URL)
Set Http = CreateObject("Microsoft.XMLHTTP")
Http.Open "GET",URL,false
Http.Send
URLGet = Http.responseText
End FunctionWhen I try to run it on a local server (Windows 2003) by double click the vbs file, I get an exception. The issue is - when the script executes to Http.Send line, it throws folowing exception.
Error number: 8007005
Descrption: Access is denied.
Source : msxml3.dll
But, I am currently logged as local Admin account of the windows server.
I don't how to resovle such a permission problem?
Can anyone help me out?
(BTW, I can run the script on another XP machine without problem.)
Thanks,
James
- Moved by Qi Samuel ZhangModerator Tuesday, February 22, 2011 5:01 AM (From:XML in Windows (MSXML and XmlLite))
Tuesday, July 20, 2010 11:36 AM
Answers
-
Since you run the script on local machine, and to avoid security problem (like downloading a virus file), XMLHTTP explicitly forbids client to open an Internet URI from a Local script. In this case, you can use ServerXMLHTTP instead.
url = "http://www.google.com/"
WScript.Echo url
WScript.Echo urlget(url)
Function URLGet(URL)
Set Http = CreateObject("MSXML2.ServerXMLHTTP.6.0")
Http.Open "GET",URL,false
Http.Send
URLGet = Http.responseText
End Function- Proposed as answer by Kurt SongMicrosoft employee Thursday, July 22, 2010 2:51 AM
- Marked as answer by Qi Samuel ZhangModerator Friday, July 23, 2010 6:21 PM
Wednesday, July 21, 2010 2:45 AM -
After you add the link to trust list, can you visit google.com? If you can visit google.com in IE, you should be able to access it through the script.
Shuhai Shen - http://leonax.net- Marked as answer by Qi Samuel ZhangModerator Friday, July 23, 2010 6:21 PM
Wednesday, July 21, 2010 4:28 AM
All replies
-
Have you tried to access google.com from IE on the Windows 2003 server? Does IE shows the content as usual?
BTW, could you provide the file version of msxml3.dll? The file is located in %SystemDrive%\Windows\system32\.
Shuhai Shen - http://leonax.netTuesday, July 20, 2010 2:12 PM -
Have you tried to access google.com from IE on the Windows 2003 server? Does IE shows the content as usual?
BTW, could you provide the file version of msxml3.dll? The file is located in %SystemDrive%\Windows\system32\.
Shuhai Shen - http://leonax.net
Hi,Thanks!
The version is :
MSXML 3.0 SP10 (8.100.1050.0)
When I open the link in IE, it pop up a security alert and ask me to add it into trust list.
Tuesday, July 20, 2010 11:40 PM -
Since you run the script on local machine, and to avoid security problem (like downloading a virus file), XMLHTTP explicitly forbids client to open an Internet URI from a Local script. In this case, you can use ServerXMLHTTP instead.
url = "http://www.google.com/"
WScript.Echo url
WScript.Echo urlget(url)
Function URLGet(URL)
Set Http = CreateObject("MSXML2.ServerXMLHTTP.6.0")
Http.Open "GET",URL,false
Http.Send
URLGet = Http.responseText
End Function- Proposed as answer by Kurt SongMicrosoft employee Thursday, July 22, 2010 2:51 AM
- Marked as answer by Qi Samuel ZhangModerator Friday, July 23, 2010 6:21 PM
Wednesday, July 21, 2010 2:45 AM -
After you add the link to trust list, can you visit google.com? If you can visit google.com in IE, you should be able to access it through the script.
Shuhai Shen - http://leonax.net- Marked as answer by Qi Samuel ZhangModerator Friday, July 23, 2010 6:21 PM
Wednesday, July 21, 2010 4:28 AM -
Since you run the script on local machine, and to avoid security problem (like downloading a virus file), XMLHTTP explicitly forbids client to open an Internet URI from a Local script. In this case, you can use ServerXMLHTTP instead.
Since when is this happening? It didn't use to be like this! When did this change occur?
Friday, February 11, 2011 3:42 AM -
That did the trick for me.
Much thanks!!
Friday, February 8, 2013 6:31 PM