Notifications
Clear all
[Closed] Dotnet "system.net.webClient" download file?
Sep 04, 2013 2:25 pm
Hi,
Does anyone know how to use system.net.webClient to download file?after searched forum,found this topic shows infomation about how to handle web events:
http://forums.cgsociety.org/showthread.php?t=855694
but i want to download a page content,so how can i do that?
request = (dotNetClass "system.Net.WebRequest").create "http://www.google.com"
request.Credentials = (dotnetClass "System.Net.CredentialCache").DefaultCredentials
response = request.GetResponse()
--download content
...
3 Replies
1 Reply
Sep 04, 2013 2:26 pm
wc = dotnetobject "System.Net.WebClient"
wc.downloadFile <uri> <localfile>
wc.dispose()
1 Reply
Oh,thanks lo,I tried this way to download file before,the important thing is ,this way cannot use “timeout” command,but “system.Net.WebRequest” can ,does “System.Net.WebClient” can timeout too?
Or a way to download file with “system.Net.WebRequest” ?
--m=url
request = (dotNetClass "system.Net.WebRequest").create m
request.Timeout = 1000
--...