FAQ Database Discussion Community


Need to call method as soon as server starts responding to my HttpWebRequest

c#,winforms,httpwebrequest,.net-4.5,httpwebresponse
I need to call a method in new thread for ex: mymethod() as soon as server starts responding to my HttpWebRequest. I am using below to send http requst and getting response. HttpWebRequest request = (HttpWebRequest)WebRequest.Create(MyUrl); HttpWebResponse response = (HttpWebResponse)request.GetResponse (); Now what i need is for my request when...

Download Files From Web Server

vb.net,httpwebrequest,httpwebresponse
I have the following response from a URL. How do I code to download the two files to my hard drive with the name = id. HTTP/1.1 200 OK Content-Type: application/json { "files": [ { "format": "fillz-order-tab", "checksum": "6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b", "acknowledged": false, "uri": "https://file-api.fillz.com/v1/orders/created/20140611T003336Z-8b975127", "date_created": "20140611T003336Z", "id": "20140611T003336Z-8b975127" }, { "format":...

C# - StreamReader.ReadToEnd() is extremely slow

.net,performance,stream,streamreader,httpwebresponse
I'm making a Web Crawler and I just found out that one of my methods, GetHTML, is very slow because it uses a StreamReader to get a string of the HTML out of the HttpWebResponse object. Here is the method: static string GetHTML(string URL) { HttpWebRequest Request = (HttpWebRequest)WebRequest.Create(URL); Request.Proxy...

VB Httpwebresponse get content

vb.net,httpwebresponse
On the following webpage I'd like to get all the titles of youtube videos in my listbox1 Dim webRequest As WebRequest = webRequest.Create("https://www.youtube.com/results?q=test") Dim webresponse As WebResponse = webRequest.GetResponse() Dim sr As System.IO.StreamReader = New System.IO.StreamReader(webresponse.GetResponseStream()) Dim youtube As String = sr.ReadToEnd Dim r As New System.Text.RegularExpressions.Regex("title="".*""") Dim matches As...

Checking response status of web pages and getting intermittent timing out replies

c#,networking,httpwebrequest,httpwebresponse
I am creating a windows service that checks the status of various services that I have. The problem is that 9 times out of 10, the response "times out". There was a few times that google.ca timed out. Here is my code try { var myRequest = (HttpWebRequest)WebRequest.Create(url); NetworkCredential networkCredential...

How to call add account method for tempoplugin with post in C#

c#,httpwebrequest,http-post,jira,httpwebresponse
At this url there is a description how to call tempoplugin with usage of post. In order to achieve it, I created following string: also created following code for posting data: public static string HTTP_POST(string Url, string Data, string userName = "", string password = "") { string Out =...

Can't get ResponseStream from WebException

c#,.net,httpwebresponse,system.net.webexception
I have a desktop client, that communicates with serverside via Http. When server has some issues with data processing it returns description of an error in JSON in Http response body with proper Http-code (mainly it is HTTP-400). When i read HTTP-200 response everithing's fine and this code works: using...

Does all http web Responses have content length field in the header ?

web-services,http,url,httpwebresponse,webresponse
Is there a standard, that says that all the http responses should have a Content-length field. Or is it URL specific?

Convert Xml document to C# Dictionary

c#,xml,dictionary,xmldocument,httpwebresponse
I make a request to a service and receive an xml response as shown below. However, I'm trying to store the response values in a Dictionary (or store the values returned in variables) and I can't seem to make it work. Any help would be greatly appreciated. xml response received:...