views:

196

answers:

3

I think it may have something to do with the external file but I am getting the error Path not found and don't know why. Code below.

<%

Dim fs
set fs = Server.CreateObject("Scripting.FileSystemObject")
fs.CopyFile "http://domain.com/file.xml","softvoyage.xml"
set fs = Nothing

%>DONE.
A: 

Are you sure CopyFile can resolve that URL?

Plan B
+3  A: 

The FileSystemObject is made for local disc files ONLY. Try this:

<%
    url = "http://www.espn.com/main.html" 
    set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") 
    xmlhttp.open "GET", url, false 
    xmlhttp.send "" 
    Response.write xmlhttp.responseText 
    set xmlhttp = nothing 
%>

Found at http://classicasp.aspfaq.com/general/how-do-i-read-the-contents-of-a-remote-web-page.html

egrunin
"local disc files" or files available over a UNC file share.
AnthonyWJones
@Anthony: Yes, thanks.
egrunin
+1  A: 

I don't believe the CopyFile method can copy files from http sources. The only examples i've ever seen for the source parameter are for files on the local file system:

FileSystemObject.CopyFile "c:\srcFolder\srcFile.txt", "c:\destFolder\"

If you need to save data from an http request, check out the IXMLHTTPRequest object.

Bryan