httpwebrequest

Downloading files. Network problems causes corrupt files.

My application downloads huge files using HttpWebRequest -> WebResponse -> Stream -> FileStream. See code below. With following the scenario we always get corrupted files: Start download. Unplug cable or click to pause download process. Close and open the application. Start download (it starts from the interruption point). Wait full f...

Is there a standard way to access page paramaters in portlets ?

If I have a request for a page containing portlets like this www.foo.com/portal/page?something=bar Is there a standard way to find the value of "something" parameter in a portlet ? There doesn't seem to be a way to access HttpServletRequest in JSR-286. Portals like LifeRay have their own utilities to do that but I'd love to have a standa...

Inconsistent POSTing between Web Browser and HttpWebRequest

I’m working on Web Scraping using C# HttpWebRequest/HttpWebResponse. For the most part this process has gone smoothly. But after POSTing my way through several pages, I have gotten stuck with what seems to be an inconsistency between testing with the Web Browser and the HttpWebRequest/HttpWebResponse calls. The problem occurs when I...

Forms Authentication and HttpWebRequest

Hi, I need to be able to login to a site via Forms Authentication using a HttpWebRequest. Currently, when I provide NetworkCreditials to the request, it just redirects me to the Login page, which makes sense...but how do I go about ensuring that the request correctly authenticates without redirecting? Thanks, Kieron ...

How to Create Asynchronous HttpWebRequest in Silverlight( F#)

As I mentioned, because Silverlight HttpWebRequest.Create hangs inside async block, I just created a bundle of callback functions to implement the same async block. The login process requires two steps : 1) Get request to a page that returns a cookie 2) Form Post to a second page that passes that cookie w/ it and performs the authen...

.NET Compact Framework WebRequest Performance

WebRequest calls on .NET Compact Framework seem very slow. Are there any tips or tricks for high performance web request calls on Windows Mobile? Just looking to make a few json calls here, and they seem to take a really long time by default. But if I try the same calls on the iPhone, etc. I don't see the same lag. ...

How to escape URL-encoded data in POST with HttpWebRequest

I am trying to send an URL-encoded post to a REST API implemented in PHP. The POST data contains two user-provided strings: WebRequest request = HttpWebRequest.Create(new Uri(serverUri, "rest")); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; request.Headers.Add("Content-Transfer-Encod...

Standard for adding multiple values of a single HTTP Header to a request or response

If I want to add a list of values as an HTTP Header, is there a standard way to do this? I couldn't find anything (that I could easily understand) in RFC 822. For example, is comma separated values standard or semi-colon separated values. Is there a standard at all? Example: Key: value1;value2;value3 ...

Is it possible to access a .Net Web Service using HttpClient/HttpPost?

Dumb question, but I just can't seem to get it to work. I'm passing in parameters and returning string values, but all I receive is: org.apache.http.conn.EofSensorInputStream. Do I need to do something special in my web service to access the parameters being passed? ...

Reading a repeating streaming data source in C#

Hello Everyone, Let's say I have a url to a streaming data source (for example a stream of updated weather data) and I know this url works with GET (I verified that it does return steaming data). The stream is compressed with GZIP, each "message" begins with a 1 byte id, a 2 byte part containing the message length, then another 2...

Sending WebResponse to browser and making user continue to use website

Hello, i made some WebRequest's and got Responses to a site and succesfully posted data for 3 pages. Now the last page is a confirmation page and i need to make the user click the confirm button. But when i write response content to the browser like this response = request.GetResponse() as HttpWebResponse; dataStream = response.GetResp...

HttpWebRequests sends parameterless URI in Authorization header

I'm connecting to a web service from .NET, like: var request = (HttpWebRequest) WebRequest.Create(uri); request.Credentials = new NetworkCredential("usr", "pwd", "domain"); var response = (HttpWebResponse) request.GetResponse(); The authorization header looks like: Authorization: Digest username="usr",realm="domain",nonce="...", ...

HttpWebRequest stalls when there are multiple keep-alive requests

Hi, I am trying to write a load-testing client for a web service server I've wrote. The client interacts with the server using HTTP. The regular clients for my service should use HTTP keep alive (by using HTTP 1.1 and not setting the KeepAlive value to false in HttpWebRequest) so that their TCP connections stay up for later HTTP reques...

First HttpWebRequest in a fresh AppDomain is slow, but not always

I'm trying to understand a performance issue I'm having when creating new AppDomains and executing HttpWebRequests in these. Have a look at my Host.exe: private static void Main(string[] args) { for (int i = 0; i < 3; i++) { AppDomain domain = AppDomain.CreateDomain("Foo"); try { Console.Wri...

simple php to return an image returns an error

Trying to simply get an image returned. But the following returns an error 'An error occured.' Is it possible I need to configure php on my server differently? if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] )) { // get bytearray $im = $GLOBALS["HTTP_RAW_POST_DATA"]; // add headers for download dialog-box header('Content-Type: image/j...

What is happening when you enter

First URL stands for Uniform Resource Locator. It will be very difficult to remember an IP address. Instead of remembering the IP addresses URL came like www.intrepidkarthi.com. Url normally contains three parts. For example http://intrepidkarthi.com/index.php. Here "http" refers to the protocol it uses. Then the server name and then the...

How does an asp.net page know which button triggered a postback?

I'm writing some code which mimics the effect of making a postback to a page by executing exactly the same web request that would be generated on clicking a button that triggers the page postback. The problem is that the response from the web request is not the same as what I get when clicking on the button. On investigating, I see tha...

How to time an Asychronous HttpWebRequest?

Hi all, I am wondering if there is a way to time an Asyhcnronous WebRequest. I am using the HttpWRequest.BeginGetResponse(new AsyncCallback(UpdateItem), si); si = StoreInfo and is a class instance storing the Request,URL, and a stopwatch which I started). In the UpdateItem routine I get the stopwatch and stop it. Problem is the stopwa...

How to do HTTPS with TcpClient just like HttpWebRequest does?

I've got a communication system based on TcpClient, and it works great except for when it's doing HTTPS to a particular IP. Then it starts to fail. By using a browser or HttpWebRequest, I have no problems doing HTTPS to that IP. I've created a test program to narrow my problem down to its basic essence, you can have a look at it here ...

How to see network requests made by a swf

I have a swf (flash file) who is making http request. Which is the easiest way to see what request the flash application is doing? P.S. I do not have the program as a fla file ...