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

401 Unauthorized when connecting to API through Azure Traffic Manager in C#

I have the following code that successfully connects to a third party API in C#: using (var client = new WebClient()) { client.Credentials = new NetworkCredential(login.Username, login.Password); var xml = client.DownloadString(url); …
Mike Cole
  • 14,474
  • 28
  • 114
  • 194
1
vote
1 answer

Howto Cancel Async Download of one file witihn mutiple file downloads?

i use some code to download mutiple files, which works good. while downloading a lot of files, i would like to be able to cancel them. Besides the UI with a cancel button i use as global variables: private WebClient client = null; private…
biohell
  • 304
  • 3
  • 14
1
vote
3 answers

Progress bar in webclient

So, I have a script which shows Download Progress from FTP. I just try many ways to solve this task. One of the conclusions was that cmdlet Register-ObjectEvent is a really bad idea.. Async eventing is rather poorly supported in Powershell... And I…
1
vote
0 answers

C# WebClient Not Finishing File Download

I have a C# application which functions as an updater. The program checks a file on the internet for a current version, and if that version is greater than the installed version, it will proceed to download an executable (not .zip) file from a web…
Question Asker
  • 199
  • 2
  • 18
1
vote
1 answer

ApiController BadRequest(string message) method is not returning the custom message passed in parameter

On my console application I am making following webClient Request to upload the data. using (var client = new WebClient()) { client.Headers.Clear(); client.Headers.Add("Content-Type", "application/json; charset=utf-8"); …
1
vote
1 answer

C# WebClient IOException in DownloadCallback

When attempting to download asset files for Minecraft, half of the files fail with a download error : "An exception occurred during a WebClient request." With the InnerException being : "{"The process cannot access the file…
Unknown025
  • 21
  • 5
1
vote
2 answers

Passing an Exception to an HttpHandler

I am trying to pass an exception to an HttpHandler by doing the following: catch (Exception e) { byte[] exceptionData; MemoryStream stream = new MemoryStream(); BinaryFormatter formatter = new BinaryFormatter(null, new…
Hungry Beast
  • 3,677
  • 7
  • 49
  • 75
1
vote
0 answers

How to bind data via PHP?

I have a C# program that runs WebClient to bind data from MySQL database. When my query arrives, the server drops the notice: Trying to get property of non-object on line 46. Here is my PHP code:
1
vote
1 answer

Possibility of editing a piece of data on a website using C#.Net Built Desktop Software

Warm greetings. I am trying to find out if there is a way of editing/updating something on a website using a piece of software made in C#. By this I mean, if the website prompts a user to enter a number for some field and displays it on the site,…
1
vote
0 answers

What is the fatest way to deserialize 700 webpage to json and add it to local database?

i load and add to my local database 700 json webpages like this : private static Api.Root LoadJsonPages(int PageNbr) { Uri url = new Uri("www.website.com//page=" + PageNbr); string info = new WebClient().DownloadString(url); result =…
KTG
  • 53
  • 3
1
vote
1 answer

Vertx WebClient SSL redirect fails

I am trying to make a connection to a 3rd party API that requires an api key. It works fine using traditional HttpURLConnection... I get a 200 response HttpURLConnection connection = (HttpURLConnection) new…
Jennifer
  • 31
  • 4
1
vote
2 answers

error invalid conversion from int to const char* [fpermissive] in C

I get this error when i run the following code , on line 21 Error error invalid conversion from int to const char* [fpermissive] Code receive(struct sockaddr_in sockad, struct message m){ int rc; int i; int ibuf; i = sizeof(sockad); …
1
vote
1 answer

bot.sendphoto does not work asp.net

I have a problem when I use the following code: try { var url = "https://www.telegadmin.com/image/tinakish/qavasi.jpg"; var uri = new Uri(url); using (WebClient webClient = new WebClient()) { using (Stream stream =…
1
vote
0 answers

WebRequest defining body parameters - method POST in C#

I have code: var request = (HttpWebRequest)WebRequest.Create("http://www.dba.dk/ajax/vip/telephonenumber/gettelephonenumber/?externalid=1033601271"); string stringData = "externalid=1033601271"; var data =…
mdieod
  • 49
  • 2
  • 12
1
vote
1 answer

C# Read random line from URL

Skip to TLDR version if you aren't up for an explanation of my logical processing. I've been fiddling around with a program which does the following: On button click, reads random line from a locally stored text document, without the ability to…
Storm
  • 25
  • 5
1 2 3
99
100