URGENT - CreateObject("ADODB.Stream") errors on Windows XP with SP2

I was using the following client side script to download a file onto a client pc with Windows XP Pro SP1

<HTML>
<HEAD>
<script language=VBScript >
'===============================================================
' Example using ADODB Stream Object to load resource from server
' and deposit in specified directory on client, using client-side
' script
' Peter Bromberg
'================================================================
' Don't need the TypeLib METADATA at the top if you specify the constants by numeric value instead of by name

' Set up an ADO Stream ....
Dim objStream
Set objStream = CreateObject("ADODB.Stream")
objStream.Type = 1 ' adTypeBinary
' The following should be the absolute URL to the file on the server.....
objStream.Open ("URL=http://myservername/virtualdirname/test.doc")
document.write "<CENTER>Loaded...<BR>"
' This should be the full path and filename to save the file on the client....
objStream.SaveToFile "C:\test.doc", 2 ' adSaveCreateOverWrite
document.write "saved..<BR>"
objStream.Close
Set objStream = Nothing

</script>
<TITLE>Download and Install Page</TITLE>
</HEAD>
<BODY>
DONE!</CENTER>
</BODY>
</HTML>


After installing SP2, I am getting an error "Safety settings on this computer prohibit accessing a data source on another domain."  I am calling the page from http://myservername/virtualdirname/getfile.htm  Why does the error indicate that I am accessing another domain?  The code works fine on Windows 2000.  Where is this safety setting?  How can I configure it?
sndipAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jmelikaCommented:
This is no longer possible with XP SP2.  It's considered a bug in IE and Windows so it's automatically disabled.

Consider using a different method in your script.  Have you thought of using ServerXMLHTTP?

      Dim objSvrHTTP
      Dim PostData
      
      Set objSvrHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
      objSvrHTTP.open "GET", "http://myservername/virtualdirname/test.doc", false

      objSvrHTTP.send
      Response.Write objSvrHTTP.responseText
0
sndipAuthor Commented:
Thanks for the info on SP2.  What is the requirements for using Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")?  Can you give me the sample code on the client to write the file to their harddrive?
0
jmelikaCommented:
It's really simple.  The sample code I gave you will do.  If you need further help with the object, you might want to do a google search for the Msxml2.ServerXMLHTTP.4.0

Here is a page that explains some of it.

http://www.eggheadcafe.com/ng/microsoft.public.inetserver.dbweb/post2131077.asp
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

mk_bCommented:
Im running xpPro  sp2 and i changes your and this is working for me give it a shot

<HTML>
<HEAD>
<%
'===============================================================
' Example using ADODB Stream Object to load resource from server
' and deposit in specified directory on client, using client-side
' script
' Peter Bromberg
'================================================================
' Don't need the TypeLib METADATA at the top if you specify the constants by numeric value instead of by name

' Set up an ADO Stream ....
Dim objStream
Set objStream = CreateObject("ADODB.Stream")
objStream.Type = 1 ' adTypeBinary
' The following should be the absolute URL to the file on the server.....
objStream.Open ("URL=http://markb/_002.doc")
response.Write "<CENTER>Loaded...<BR>"
' This should be the full path and filename to save the file on the client....
objStream.SaveToFile "C:\test.doc", 2 ' adSaveCreateOverWrite
response.write "saved..<BR>"
objStream.Close
Set objStream = Nothing
%>

<TITLE>Download and Install Page</TITLE>
</HEAD>
<BODY>
DONE!</CENTER>
</BODY>
</HTML>
0
sndipAuthor Commented:
mk_b, you changed it from client vbscript to server side script.  I need the file to be saved on the client's harddrive.  How do I save the file to the client's harddrive after using objStream.Open on the server?
0
jmelikaCommented:
Try this code:

'GetRemoteBinaryFile.vbs

ImageFile = "file.doc"
DestFolder = "C:\"
URL = "http://www.site.com/file.doc"

Set xml = CreateObject("Microsoft.XMLHTTP")
xml.Open "GET", URL, False
xml.Send

set oStream = createobject("Adodb.Stream")
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
Const adSaveCreateNotExist = 1

oStream.type = adTypeBinary
oStream.open
oStream.write xml.responseBody

' Do not overwrite an existing file
oStream.savetofile DestFolder & ImageFile, adSaveCreateNotExist

' Use this form to overwrite a file if it already exists
' oStream.savetofile DestFolder & ImageFile, adSaveCreateOverWrite

oStream.close

set oStream = nothing
Set xml = Nothing

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.