webclient

Webclient.Uploadfile

I have an app that uploads files to server using the webclient. I'd like to display a progressbar while the file upload is in progress. How would I go about achieving this? ...

how can I check for an existing web folder

Hello, I work as software tester entry level and I was given a task to save my log files to the specific folder on my company website and this website only can be accessed internally by the company employees. So far I know how to save file onto the site, but how would I check which specific folder is already there before I save the fil...

How to set port for webclient in c#?

Hi, I am trying to download a file using webclient in c#. the remote port of the file location is 20114. How do I tell webclient to use 20114 port? ...

How to read a WebClient response after posting data? (.NET)

Behold the code: using (var client = new WebClient()) { using (var stream = client.OpenWrite("http://localhost/", "POST")) { stream.Write(post, 0, post.Length); } } Now, how do I read the HTTP output? ...

How to read an ASP.NET internal server error description with .NET?

Behold the code: using (var client = new WebClient()) { try { var bytesReceived = client.UploadData("http://localhost", bytesToPost); var response = client.Encoding.GetString(bytesReceived); } catch (Exception ex) { } } I am getting this HTTP 500 internal server error when the UploadData method ...

How to solve Gzip Magic Number Missing

I have a string that I Gzip on the server and download to a client using the WebClient class. When I try to uncompress it, I get the error message that the Magic Number is missing. I have tried both the GZipStream class and the ICSharpLib methods of solving this, so I'm at a loss. The compression/decompression works if I omit the step o...

System.Net.WebClient doesn't work with Windows Authentication

I am trying to use System.Net.WebClient in a WinForms application to upload a file to an IIS6 server which has Windows Authentication as it only 'Authentication' method. WebClient myWebClient = new WebClient(); myWebClient.Credentials = new System.Net.NetworkCredential(@"boxname\peter", "mypassword"); byte[] responseArray = myWebClient...

Strange Timeout WebException in HTTP Get using WebClient

Hi, I have a multi-thread application (in c#) that it does multiples HTTP GET to uri. Suddenly after of thousand of requests, i get timeout webException but destination server is OK if i test using browser. The code is: public static string Get(string uri) { string responseData = string.Empty; using (WebClient wc = new WebClien...

How can I read in C# XML from another page while logged in to the site

I have logged in to the site with my webbrowser and whenever I try to call WebClient myWebClient = new WebClient(); string str = myWebClient.DownloadString("http://localhost/myxml.aspx"); Response.Write(str.ToString()); Or XmlTextReader reader = new XmlTextReader(url); while (reader.Read()) { Response.Write(reader.ReadOuterXml()); ...

WebClient.UploadData correct usage for post request

i think i am going a bit crazy, when i test this on my local webserver, it works fine when i go out to the live website, it returns a blank string instead of the data i am expecting i am not that familiar with C#, so i just wanted to check i am doing things right. the data is just plain ascii text wc = new WebClient(); wc.Headers.Add...

WebClient.DownloadData giving up?

I have a spider on our website that requests about 42000 pages to click, it takes between 2-4 days to run but recently it has been reaching about 20000 and then every single page request fails with a timeout until eventually the whole service crashes out. Does anyone have any idea why this might be happening and how i can relieve some pr...

getting a header/filesize .NET

I have a link to two files, they may be the same file but they may not be the same URL. I want to figure out if they are the same by checking the content-length before doing a full download. Whats the best way to do this? Currently i am using webbrowser control to load the page and extract data then using WebClient.Download to get the fi...

Alternatives to using WebClient.BaseAddress to get base url in Silverlight

In a Silverlight application I sometimes need to connect to the web site where the application is hosted. To avoid hard coding the web site in my Silverlight application I use code like this: WebClient webClient = new WebClient(); Uri baseUri = new Uri(webClient.BaseAddress); UriBuilder uriBuilder = new UriBuilder(baseUri.Scheme, baseUr...

C# JSON WebClient Request throwing ex

Not really sure why I'm getting the exception.. the code is sound and the API is working through my browser. var url = new Uri("http://octopart.com/api/search?keywords=" + topic.Text); WebClient octopartCall = new WebClient(); octopartCall.OpenReadCompleted += new OpenReadCompletedEventHandler(Octopart_Completed); ...

Why does my WebClient request work differently depending on it's hosting solution?

In it's very basic form I have a WebClient request for some xml in a Page.xaml code behind. Something like: public Page() { InitializeComponent(); Uri uri = new Uri("Dummy.xml", UriKind.Relative); WebClient webClient = new WebClient(); webClient.DownloadStringCompleted += new DownloadStringCompl...

System.Net.WebClient vs. Proxy Authentication 407 error

I'm trying to figure out how to robustly handle proxy authentication errors (HTTP 407 status code) when using the System.Net.WebClient class. In the field, we see many users receiving a 407 proxy authentication WebException, but I'm not sure what a good default strategy is. In .Net 2.0/3.5, the proxy authentication settings are supp...

Exception on C# - but program still works

Here's what's going on. I'm opening a file on FTP that exists using a WebClient. The file exists and the function has worked in the past, but now for some reason throws an exception. (System.Net.WebException: The remote server returned an error: (550) File unavailable (e.g., file not found, no access).). The funny thing is, the script st...

Error downloading files from asp.net mvc web application

I am having this really weird issue with downloading files from within ASP.Net MVC (not downloading FROM the app, TO the app) and hope someone can help me out. This bit of code running in a controller: using (var wc = new WebClient()) { var siteText = wc.DownloadString("http://www.google.com"); re...

Multiple WebClients, Over time weclints stop working

Hey all, first time poster, long time reader, so take it easy on me :) I'm writing an application that reads in a bunch of folders and allows you to download an image for each folder. There is a WebBrowser control where you can browse to a particular image, and click a button "use this image for the selected folder". Each "folder" is r...

Setting the user state when downloading asynchronously

VS 2008 SP1 I am using the web clicent to download some files asynchronously. I have 5 files to download. However, I want to monitor each download and want to set the user state as the name of the file, so in the ProgressCompletedEvent I can check the user state to see which file has completed? He is a short code snippet of what I am...