Questions tagged [webclient]

WebClient is a class for .NET Framework applications that provides methods for sending and receiving data from a resource identified by a URI.

Read more about the WebClient class and its usage here: https://learn.microsoft.com/en-us/dotnet/api/system.net.webclient

4098 questions
1
vote
1 answer

Tpl implementation issue

Tpl Sample Click here to download Hi , I am trying to implement tpl in my project . where i have created 5 parallel HTTP call using web client . What i am trying to achieve. If any of 5 parallel call return me string containing "First" Then kill…
1
vote
0 answers

html tags isn't recognized in source code

I use a method in C# which download source code of website but the relevant html tag isn't there always. for example "
Sine1
  • 39
  • 3
1
vote
2 answers

WebClient returns 500 (Internal Server Error) in DownloadFile while browsers do load the image

I would like to download an image from a website using WebClient. I checked with a browser if the image exists, and it does. I'm using this code to download the image: Private Function pDownload(ByVal uFrom As String, ByVal uTo As String) As…
tmighty
  • 10,734
  • 21
  • 104
  • 218
1
vote
2 answers

System.Net.WebException: The underlying connection was closed: An existing connection was forcibly closed by the remote host

I have seen a few other threads on this but haven't found a solution. When running my C# Windows From from debug mode, I am able to use the WebClient to read data from a web page. However, as soon as I create the executable for the application, I am…
Tyler Wilson
  • 99
  • 3
  • 11
1
vote
2 answers

Changing from HttpClient to Webclient, sending password as plain text

I have an async method that uses HttpClient: private static HttpClient client = new HttpClient(); //As pointed by @maccettura private async Task GetResult(Uri url, string user, string pass) { var PassArray = new…
Yasskier
  • 791
  • 1
  • 14
  • 36
1
vote
1 answer

get downloaded file from URL and Illegal characters in path

string uri = "https://sometest.com/l/admin/ical.html?t=TD61C7NibbV0m5bnDqYC_q"; string filePath = "D:\\Data\\Name"; WebClient webClient = new WebClient(); webClient.DownloadFile(uri, (filePath + "/" +…
Florin M.
  • 2,159
  • 4
  • 39
  • 97
1
vote
1 answer

VB.Net httpwebrequest login and download page

I want to login with my account to VyprVPN website. So i logged in successfully with my code below, but i want to get number of remaining data, which is stored in this url: https://www.goldenfrog.com/controlpanel/vpn-remaining as pure html. So…
1
vote
1 answer

Page to download a file requires processing in webclient

I'm trying to use a java servlet in a 3rd party tool's web interface (CA service desk) to invoke it's download file functionality using a webclient in vb.net. The trouble is the text stream from response is markup and not the acutual text file…
Tom Pickles
  • 890
  • 10
  • 26
1
vote
2 answers

cURL in .NET application

I have a cURL command provided by WooCommerce: curl https://example.com/wp-json/wc/v2/orders \ -u consumer_key:consumer_secret I'm using WebClient: using (WebClient wc = new WebClient()) { Uri url = new…
Dom
  • 83
  • 7
1
vote
1 answer

Can't de-serialize the current JSON object, error in xamarin.forms

I am making an Api request in my Xamarin.forms app, the request is to display list of stores but it's throwing the following exception : Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type…
user4857063
1
vote
1 answer

How to cache azure blob storage files

I have approx 6 settings files (xml or json) that I'd like to store in Azure but use in my Windows Client application. I plan to store them in blob storage and download them using the following code: var myWebClient = new…
Matt Fitzmaurice
  • 1,319
  • 4
  • 19
  • 40
1
vote
1 answer

upload serialized data using WebClient

Simple requirement . I have a class - User - {userId, userName, age}. How to serailize a object of the class and sent to a url (using post) using webclient. Something Like below. What is the best way to serialise user object into postdata…
1
vote
0 answers

Windows service unable to bypass company filter; but running exe has no issues

I have this Windows service that is fetching data using .NET's Webclient. It works perfectly fine when I am debugging or running the exe But when I install and run the service (on same computer), only then is it hitting my company filter. I get back…
1
vote
2 answers

How to receive a byte array and header content in a ASP.NET Core Web API Controller

I need to receive a content together with a byte array in a c# ASP.NET Core Web API application. **--HttpClient (console Application)** Dictionary fileparts = new Dictionary(); int…
Lakmal
  • 779
  • 1
  • 8
  • 16
1
vote
1 answer

WebClient DownloadStringAsync is loading very slowly

Update: I have tried HttpWebRequest and it is also exhibiting the same behaviour. I'm trying to use WebClient DownloadStringAsync to retrieve some (very small) data in an Outlook add-in (VSTO/.Net 4.0). It's taking about 10-15 seconds before it even…
Luke Chadwick
  • 1,648
  • 14
  • 24