httpwebrequest

Simple server and client request/response in C#

OK. I just want to know if this can be done. I'm using C# asp.net language. I want to send a structure to a webserver from a webpage (much like you you can pass a structure to a function). The server would act on the data found in the structure, and then return back the structure (with its contents modified) to the "client" webpage....

URL encoding issue - HttpWebRequest doesn't work, Firefox does

I'm trying to call a rest webservice provided by a lims system (basically a chemistry lab database + interface). It was working great until some > ascii characters showed up (specifically characters with circumflexes, umlauts, etc.) When calling the webservice passing the value àèïõû I have the following argument: &componentValue=àè...

HttpWebRequest.EndGetRequestStream issue in Silverlight

I am using HTTPWebRequest to post data to a webserver in Silver light 3.0, here is my code public void MakePostRequest() { // Create a new HttpWebRequest object. HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.mywebsite.com/somepage.php"); // Set the ContentType prop...

401 Error using HTTPWebRequest with Active Directory Authentication in DotNetNuke

Has anyone successfully used the System.Net.HTTPWebRequest with Active Directory authentication in a DotNetNuke website? I have looked around and found several references to HTTPWebRequest and Active Directory authentication, but none seem to have the special sauce. I have tried uncountable variations of the attributes/methods, without s...

HttpWebRequest does not include "Pragma: no-cache" header when doing a POST

I'm using an HttpWebRequest that has a CachePolicy of HttpRequestCacheLevel.Reload. When doing a GET the "Pragma: no-cache" header is in the request (as tracked through Fiddler). But when doing the exact same request using a POST then the "Pragma: no-cache" header is not included. Is there a reason for this? Is it a bug? And is there a ...

HttpWebRequest.Address vs HttpWebResponse.ResponseUri

Whats the difference between these two properties? To put into context, I am determining if a redirect occurs if our ResponseUri != RequestUri. While a redirect occurs regardless the url http://adage.com/adages/article?article%5Fid=140560 will provide a different ResponseUri (http://adage.com/adages/post.php) than the Address (http://a...

Why am I running out of bytes for the stream while performing an HTTP POST?

This is driving me nuts: WebRequest request = WebRequest.Create(url); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = Encoding.UTF8.GetByteCount(data); Stream reqs = request.GetRequestStream(); StreamWriter stOut = new StreamWriter(reqs, Encoding.UTF8); ...

Using HttpWebRequest with dynamic URI causes "parameter is not valid" in Image.FromStream

I'm trying to obtain an image to encode to a WordML document. The original version of this function used files, but I needed to change it to get images created on the fly with an aspx page. I've adapted the code to use HttpWebRequest instead of a WebClient. The problem is that I don't think the page request is getting resolved and so the...

which scenario in http transaction is occurred ?

In http transaction for request and response which scenario is occurred ? client (web browser) open connection and send it's request and connection open (keep alive) until server accept and answer then close connection ? client (web browser) open connection and send it's request then connection is closed and server accept and answer a...

C#: Writing a CookieContainer to Disk and Loading Back In For Use

I have a CookieContainer extracted from a HttpWebRequest/HttpWebResponse session named CookieJar. I want my application to store cookies between runs, so cookies collected in the CookieContainer on one run of the program will be used the next run, too. I think the way to do this would be to somehow write the contents of a CookieContaine...

C#: Using CookieContainer with WebClient class

I've previously used a CookieContainer with HttpWebRequest and HttpWebResponse sessions, but now, I want to use it with a WebClient. As far as I understand, there is no built-in method like there is for HttpWebRequests (request.CookieContainer). How can I collect cookies from a WebClient in a CookieContainer? I googled for this and foun...

Sending Local IP address of connection associated with HttpWebrequest (C#)

I am developing an application which has one web server and one C# client which posts XML to the web server. The web server needs to know the local IP address of client. I tried methods to retrieve the IP address at the server side, but these methods don't give the IP address of the client when there are proxy servers or NAT in between. ...

Example Code (C#) for login into flickr using HttpWebRequest

Hi: I need to be able to log users into our flickr account using the account username and passwrd. I have been searching online for quite a while now but only founds bits and pieces of an implementation. I am not experienced with Http calls at all. I need a complete example. This is the code I have so far HttpWebRequest http = WebRe...

Whose responsibility is it to throttle web requests?

I am working on a class library that retrieves information from a third-party web site. The web site being accessed will stop responding if too many requests are made within a set time period (~0.5 seconds). The public methods of my library directly relate to a resource an file on the web server. In other words, each time a method is ca...

Unexpected EOF in HTTPS request

Hi everybody, I have the following function that sends xml using Https request public WebResponse SendXmlPost(string url, string xml) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.KeepAlive = false; request.ProtocolVersion = HttpVersion.Version11; request.Method = "POST"; if (this.UseBa...

How to get webpage source in asp.net c#

I say that How can i get HTML code of a page in c# asp.net Ex:- http://Google.com How i can get his html code by asp.net c# ...

HttpWebRequest Vs webclient class who is better

I can't guess who is better HttpWebRequest or webclient are you suggest me who is better for performance ...

Query Post code Lookup Web service Via Code

Hello guys! I have a url which normally points to a postcode lookup webservice: "http://pce.afd.co.uk/afddata.pce?Serial=822590&Password=<PASSWORD>&UserID=<UNAME>&Data=Address&Task=PropertyLookup&Fields=List&MaxQuantity=200&Lookup=BD1+3RA" I need to make a call to this url, probably by using Htt...

why is use of "new NetworkCredential(username, password)" not working for Basic Authentication to my website (from a WinForms C# app)???

Hi, I have a website that uses Basic Authentication (username/password). Why is the following code not working? When I run it the web application takes me to the login controller, whereas I'm expecting that it should already be authenticated given I'm populating the credentials. In other words I'm trying to confirm how, in .NET, I...

HTTP POST in .NET doesn't work

Hi all, I've got a problem with creating an HTTP post request in .NET. When I do this request in ruby it does work. When doing the request in .NET I get following error: <h1>FOXISAPI call failed</h1><p><b>Progid is:</b> carejobs.carejobs <p><b>Method is:</b> importvacature/ <p><b>Parameters are:</b> <p><b> parameters are:</b> vacatur...