Questions tagged [webclient-download]

WebClient is the .NET API for uploading and downloading files to and from the remote locations as specified by a URI. Both synchronous and asynchronous models are supported.

303 questions
21
votes
4 answers

Use WebClient with socks proxy

Is there any way to use a socks proxy with WebClient? Specifically with the DownloadString method that it provides? I don't want to use any third party stuff like privoxy, freecap whatever and I can't use commercial libraries like those from…
Para
  • 1,806
  • 4
  • 32
  • 72
14
votes
2 answers

Is there any way to monitor the progress of a download using a WebClient object in powershell?

I'm downloading a file using a simple line like this: $webclient = New-Object -TypeName System.Net.WebClient $webclient.DownloadFile("https://www.example.com/file", "C:/Local/Path/file") The problem is that I want to display a message to the user…
EGr
  • 1,751
  • 9
  • 39
  • 59
12
votes
1 answer

How can I pass default credentials to a PowerShell Web Client Object? Alternative to Invoke-WebRequest for PS v2?

I'm running the following code $client = new-object System.Net.WebClient $client.DownloadFile( $UriValue, "C:\Temp\BHRout.json" ) $json = Get-Content "C:\Temp\BHRout.json" This does not work because it needs my prompts credentials passed into the…
EGr
  • 1,751
  • 9
  • 39
  • 59
10
votes
2 answers

Download all the files in the website

I need to download all the files under this links where only the suburb name keep changing in each link Just a reference https://www.data.vic.gov.au/data/dataset/2014-town-and-community-profile-for-thornbury-suburb All the files under this search…
Bharath
  • 111
  • 1
  • 1
  • 8
10
votes
1 answer

Download a file from a Flask-based Python server

I'm trying to make work a code that I found at this URL: http://code.runnable.com/UiIdhKohv5JQAAB6/how-to-download-a-file-generated-on-the-fly-in-flask-for-python My goal is to be able to download a file on a web browser when the user access to a…
Alexandre D.
  • 641
  • 1
  • 8
  • 27
10
votes
3 answers

Does WebClient.DownloadFileAsync overwrite the file if it already exists on disk?

I can't find any information on my question. Please excuse me if my search efforts have not been good enough to find the answer. I just want to avoid spinning my wheels. Thanks! Follow up: If it doesn't overwrite, how can I get it to (if possible)?
Kashif
  • 735
  • 1
  • 10
  • 31
9
votes
2 answers

Downloading large files in Windows command prompt / PowerShell

I'm kind of running out of options now... Attempt 1 Use iwr in Powershell. It works, shows progress but its 10X slower and doesn't flush until while file is in memory :(. powershell -command "& { iwr…
Shital Shah
  • 47,549
  • 10
  • 193
  • 157
9
votes
1 answer

How to Replace WebClient with HttpClient?

I have the following WebClient inside my asp.net mvc web application: using (WebClient wc = new WebClient()) // call the Third Party API to get the account id { string url = currentURL + "resources/" + ResourceID + "/accounts?AUTHTOKEN=" +…
john Gu
  • 10,469
  • 55
  • 189
  • 381
8
votes
1 answer

Download attached file from Facebook using C# API

I able to download an image from facebook conversations using FB API but now i had a problem to download an attached file (.doc, .txt, .log and etc.) from facebook using graph FB API. Json result return by Facebook if have attached file as…
Ifwat Ibrahim
  • 1,223
  • 4
  • 15
  • 27
7
votes
5 answers

C# read line from file with StreamReader with DownloadFileAsync

I am having a problem reading file with StreamReader and while line != null add to textBox1 Code: using(StreamReader reader = new StreamReader("lastupdate.txt")) { string line; while((line = reader.ReadLine()) != null) { …
user1085907
  • 915
  • 2
  • 14
  • 31
7
votes
1 answer

WebClient DownloadFile - Access denied or could not find part of the path

I am trying to set a button so that the user can download a file saved on the server. protected void btnDownloadHtmlFile_Click(object sender, EventArgs e) { string path = @"D:\web\mytestwebsite.com\www\temp\test.html"; if…
Greg
  • 630
  • 4
  • 10
  • 20
6
votes
1 answer

How do I use DownloadListener?

I am creating an app that allows college students to download their study material from within the app instead of the browser. The home page has lots of subject names. Each subject name leads to new webpage. So, I have used WebViewClient. But, at…
Paritosh Anand
  • 85
  • 1
  • 1
  • 4
6
votes
1 answer

make download resumable using c#

I am using this method (WebClient Class) for downloading a file from the Internet : private Task DownloadUpdate(string url, string fileName) { var wc = new WebClient(); return wc.DownloadFileTaskAsync(new Uri(url), @"c:\download" +…
Sirwan Afifi
  • 10,031
  • 11
  • 54
  • 104
5
votes
1 answer

Android WebView unable to download file on DownloadStart on UIDAI/Aadhaar Website

I am using Webview to download .zip file in my app from UIDAI website. But when DownloadListener is getting called It returns the correct data, but downloads that HTML webpage in that .zip file instead of downloading the actual file. whereas when I…
Sagar Giri
  • 2,201
  • 1
  • 7
  • 19
5
votes
1 answer

WebClient().DownloadString() returning old data

I am using this code to get the return string from URL webClient.Encoding = Encoding.UTF8; response = webClient.DownloadString("http://somesite.com/code.php"); Console.Write(response); the code.php looks like this
1
2 3
20 21