hi,<BR><BR>i am running a script and the following gives me a "msxml3.dll (0x800C0005<BR>The system cannot locate the resource specified. " error<BR><BR>Set xml = Server.CreateObject("Microsoft.XMLHTTP")<BR>xml.Op en "GET", server.mappath(myPath), False<BR>xml.Send 'this line causes the error<BR><BR>I am opening, using and setting the xml object to "nothing" regulary in a loop to write a number of different files to the disk<BR><BR>can anyone help as to what is causing this error and suggest a fix.<BR><BR>thanks in advance<BR><BR>gelboe
Debug. What's the value of myPath when the error occurs?<BR><BR>I really worry about why you're using server.mappath inside that code, but we'll come to that in a minute (I'd think).<BR><BR>Craig.
i put myPath in this snippet as an example. the value in the actual code is a part hardcoded path to a folder on the server (same server as the one the asp page is running on hence the mappath) comprising of some dymamic folder and file names selected from a database. it looks like this:<BR><BR>'***<BR>xml.Open "GET", server.mappath("manualsDestination/" & rsManual("manual_source") & "/Test/" & trim(rsTargetChapters("chapterName"))), False<BR>'***<BR><BR>manual_source is a folder name from a database record and chapterName is a file name taken from another database record.<BR><BR> <BR>
please accept my apologies. i have just spotted the problem, a misplaced variable name in my path.<BR><BR>didnt pick it up in my previous set of test data because "source" and "destination" folders had the same name.<BR>rather embarrassing...<BR><BR>please explain your concern though of using mappath in the first place.<BR><BR>thanks for your time<BR><BR>gelboe
Well, Server.MapPath converts a virtual path to a physical one.<BR><BR>So "/whatever.doc" comes out as "C:siterootwhatever.doc".<BR><BR>But then you're making a HTTP request for the physical file... Why? If you want to just read the file, why not use the FileSystemObject or whatever. Using XMLHTTP seems completely wrong if you're working with local files.<BR><BR>Craig.
If all you want to do is copy the files, just use the FileSystemObject to copy them.<BR><BR>I've not done any performance testing, but I would be exceptionally surprised if it's not significantly faster than your way.<BR><BR>Significantly.<BR><BR>Craig.
...trash the entire page, just on the assumption that if the person coded something this way then the rest of it has to be wrong.<BR><BR>"okay" might be the word I'd start with, but things would go downhill from there.<BR><BR>
If there was some need to get the *binary* stream, instead of text, this might be as efficient as using ADODB.Stream.<BR><BR>But of course, if you treat it as binary then you can't do simple text manipulation of it.<BR><BR>Also to be fair, if you had code that sometimes got source from external sites and sometimes from local files, this might be a way to go.<BR><BR>Except that if you are going to use Server.MapPath, then why not, instead, just use<BR> "http://" & serverName & "/" & file<BR>and now you can just use <BR> serverName = "localhost"<BR>when the file is local.<BR><BR>Ehhh... What the heck, we can find reasons for doing most anything, can't we?<BR><BR>