How Download A File With Createobject([msxml2.xmlhttp]) In C#
-
Mar 23rd, 2007,12:53 AM #i
Thread Starter
Hyperactive Member
Download files using MSXML2.XMLHTTP
i am having a little trouble downloading a file using MSXML2.XMLHTTP
the code beneath works great *if* y'all can get a link that leads direct to the file, as in the example below
unfortunately it 'freezes' when trying to pull a file from a dissimilar sort of link, something like:Private Sub test()
Dim objHTTP As Object
Set objHTTP = CreateObject("MSXML2.XMLHTTP")
Dim stl Every bit String
Dim rtstl = "http://slmap.hostingweb.united states/examination/i.zip"
objHTTP.Open up "Get", stl, False, "exam", "test" 'unme/pwdobjHTTP.transport
rt = objHTTP.responseBodyDim oADOStream
Gear up oADOStream = CreateObject("ADODB.Stream")
oADOStream.Type = 1
oADOStream.Fashion = iii
oADOStream.Open
oADOStream.Write rt
oADOStream.SaveToFile "c:\anyfilename.nil"
oADOStream.Close
Set oADOStream = NadaSet objHTTP = Nothing
Finish Subhttp://anysite.com/231/en-usa/abc/gog...iii&saveas=1.zip
i think it freezes because the link wants to open up a dialogue box or something. i have tried to retool the link, or find some other 1 that is direct continued to the file, only on some of these monster servers with the way they bargain with uploads and downloads the best i can do is the link i merely showed.
has anybody had any experience with this?
using a webbrowser you can navigate to the link, only the webbrowser is generlaly much slower so i want to become the MSXML2.XMLHTTP road if possible. it has been working great for simply virtually everything, but i ran into this snag and need some help.
-
Mar 23rd, 2007,04:30 AM #2
Inferior Member
Re: Download files using MSXML2.XMLHTTP
I've tried this code.
Even if it is a normal downloading link, the zip file it saves on the disk is a currupted zip file and I cannot open up it.
Regards,
Raman
-
Mar 23rd, 2007,x:46 AM #three
Thread Starter
Hyperactive Member
Re: Download files using MSXML2.XMLHTTP
non sure what happened on your end, might have been that the server was down at the time (a complimentary site which is a trivial prone to be downward), simply i just ran it once again and it works perfectly. only it does not work if the link is of, for the lack of a better term, an indirect nature, which is why i posted to meet if anyone has any thoughts on this.
Originally Posted by raman_xs
Source: https://www.vbforums.com/showthread.php?459294-Download-files-using-MSXML2-XMLHTTP
Posted by: sextonromenhaving.blogspot.com

0 Response to "How Download A File With Createobject([msxml2.xmlhttp]) In C#"
Post a Comment