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
43
votes
6 answers

How to ignore a certificate error with c# 2.0 WebClient - without the certificate

Using Visual Studio 2005 - C# 2.0, System.Net.WebClient.UploadData(Uri address, byte[] data) Windows Server 2003 So here's a stripped down version of the code: static string SO_method(String fullRequestString) { string theUriStringToUse =…
JohnTheBarber
42
votes
3 answers

How do I authenticate a WebClient request?

I am making a call to a page on my site using webclient. I'm trying to get the result of the webpage put into a pdf so I am trying to get a string representation of the rendered page. The problem is that the request is not authenticated so all I get…
smartdirt
  • 1,027
  • 3
  • 14
  • 27
40
votes
5 answers

How to use Fiddler to debug traffic from Any app (eg. C#/WPF app)

I am tring to debug whats wrong with my HTTP requests from another question here on SO. So i read a bit about Fiddler and wanted to use it to debug my problem. But I can't seem to get traffic from my WPF application to go through Fiddler. I believe…
Jiew Meng
  • 84,767
  • 185
  • 495
  • 805
40
votes
4 answers

Console App Terminating Before async Call Completion

I'm currently writing a C# console app that generates a number of URLs that point to different images on a web site and then downloads as byte streams using WebClient.DownloadDataAsync(). My issue is that once the first asynchronous call is made,…
Andrew Keller
  • 3,198
  • 5
  • 36
  • 51
40
votes
9 answers

Is it possible to transfer authentication from Webbrowser to WebRequest

I'm using webbrowser control to login any site. And then i want to download some sub page html using WebRequest (or WebClient). This links must requires authentication. How to transfer Webbrowser authentication information to Webrequest or…
ebattulga
  • 10,774
  • 20
  • 78
  • 116
40
votes
3 answers

How to retrieve JSON Response from a javax.ws.rs.core.Response response?

I am making a request to an API and getting a response status code of 200. Response of the api includes a json response. import javax.ws.rs.core.Response; Response response = webclient.post(SomeReqString); How can I retrieve the json response as…
goodmayhem
  • 3,364
  • 4
  • 16
  • 17
39
votes
7 answers

C# webclient and proxy server

I am using a web client class in my source code for downloading a string using http. This was working fine. However, the clients in the company are all connected now to a proxy server. And the problem started from this. When I have tested my…
ant2009
  • 27,094
  • 154
  • 411
  • 609
39
votes
1 answer

Uncompressing gzip response from WebClient

Is there a quick way to uncompress gzip response downloaded with WebClient.DownloadString() method? Do you have any suggestions on how to handle gzip responses with WebClient?
adrin
  • 3,738
  • 8
  • 40
  • 60
39
votes
2 answers

Getting "Handshake failed...unexpected packet format" when using WebClient.UploadFile() with "https" when the server has a valid SSL certificate

I am trying to use WebClient.UploadFile with a HTTPS URL but I am ending up with "System.IO.IOException: The handshake failed due to an unexpected packet format" The same code works perfectly fine with Http but the server that I am trying to…
user1867353
  • 487
  • 1
  • 6
  • 12
38
votes
5 answers

WebClient generates (401) Unauthorized error

I have the following code running in a windows service: WebClient webClient = new WebClient(); webClient.Credentials = new NetworkCredential("me", "12345", "evilcorp.com"); webClient.DownloadFile(downloadUrl, filePath); Each time, I get the…
Matt
  • 25,943
  • 66
  • 198
  • 303
35
votes
3 answers

Sending HTTP POST with System.Net.WebClient

Is it possible to send HTTP POST with some form data with System.Net.WebClient? If not, is there another library like WebClient that can do HTTP POST? I know I can use System.Net.HttpWebRequest, but I'm looking for something that is not as…
Endy Tjahjono
  • 24,120
  • 23
  • 83
  • 123
34
votes
4 answers

WebClient restful Delete

I have a simple Restful service being called from a console app so am using WebClient. I am wondering if this call for Delete is correct. The url looks like localhost/RestService1/Person/1 using (var client = new WebClient()) { …
Jimmy James
  • 381
  • 1
  • 3
  • 6
33
votes
3 answers

HEAD with WebClient?

I am going to assume the answer is no but.... Is there a way to use WebClient to send the HEAD method and return the headers as a string or something similar?
user34537
33
votes
2 answers

Difference between shouldoverrideurlloading and shouldinterceptrequest?

Anyone please tell me the difference between methods public WebResourceResponse shouldInterceptRequest (WebView view, WebResourceRequest request) and public boolean shouldOverrideUrlLoading(WebView view, String url). I'm creating an android…
Nevaeh
  • 1,519
  • 7
  • 24
  • 45
33
votes
2 answers

How can I change the time limit for webClient.UploadData()?

I am using WebClient.UploadData() to do a post on a Java server. How can I extend the time limit? (It times out every time I am trying to do some debugging)
Grzenio
  • 35,875
  • 47
  • 158
  • 240