httpwebrequest

Catch unhandled SocketException during asynchronous HttpWebResponse read

All the asynchronous calls to HttpWebRequest.BeginGetResponse/EndGetResponse and HttpWebResponse.GetResponseStream().BeginRead/EndRead are made from try/catch blocks, however, these exceptions propagate and do not leave a chance handle them and stop application termination: Unhandled Exception: System.IO.IOException: Unable to read d...

Making a HTTP POST to a REST endpoint

Hi all, I'm trying to make a simple HTTP post a endpoint with ONLY url arguments. At least thats how I understand the following instructions: POST to that address with a single parameter named url, the address of the feed that changed. As with the XML-RPC method, it verifies that the feed has changed, and if so it notifies the ...

Can PHP 5 do request handling similar to Tomcat or GAE?

lets say i want to go to http://example.com/something/a/few/directories/deep is there a way I can process this in PHP without having to make those directories? I just want to get everything after the domain name as a variable and work from there. ...

Cookies are required to use this site. HttpWebRequest/HttpWebResponse Cookies

I am using the following code to make a HttpWebRequest and render the XML from the response stream. ` HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url); req.Accept = "/"; req.Headers.Add("UA-CPU", "x86"); req.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; MS-RTC LM 8)"; req.CookieContainer = new Cookie...

HttpWebRequest SSL only working on some websites

Hello, I'm doing some experimenting with HttpWebRequest, and need to get it working with SSL. It does work on some websites (PayPal, for instance), but not the ones I actually want it working on, such as this community website (URL is also in the code sample). Why is this? The certificates (I'm assuming this is where the problem might b...

c# HttpWebRequest POST'ing failing

So i'm trying to POST something to a webserver. System.Net.HttpWebRequest EventReq = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create("url"); System.String Content = "id=" + Id; EventReq.ContentLength = System.Text.Encoding.UTF8.GetByteCount(Content); EventReq.Method = "POST"; EventReq.ContentType = "application/x-www-form-ur...

HTTP status code 200 (cache) vs status code 304?

I'm using the Google "Page Speed" plug-in for Firefox to access my web site. Some of the components on my page is indicated as HTTP status: 200 200 (cache) 304 By Google's "Page Speed". What I'm confused about is the difference between 200 (cache) and 304. I've refreshed the page multiple times (but have not cleared my cache) and it...

httpwebrequest sending a file

Hi, I need to upload a file in C# using an httpwebrequest. I don't need to post any form data. It's a scheduled task that will run once a night and upload a file to a server. It will need to set the credentials. I've seen some examples and I'm not really sure what's happening in them and they all include form data. Would it be possible ...

HttpWebRequest to SLL Uri in Silverlight 2.0

How do I do this? It seems the SilverLight 2.0 HttpWebRequest does not allow you to set Credentials or set the Authorization header. ...

HttpWebRequest C# uploading a file

Hello, using C#, I'm trying to integrate my web store w/ an email marketing client. I want to upload a comma delimited file of subscribers once a night. They say to get this to work, it has to be a form posts: multipart/form-data, but I'm not using a form. I'm able to connect to their servers but I keep getting back a Data can't be blan...

WebClient vs. HttpWebRequest/HttpWebResponse

It seems to me that most of what can be accomplished with HttpWebRequest/Response can also be accomplished with the WebClient class. I read somewhere that WebClient is a high-level wrapper for WebRequest/Response. So far, I can't see anything that can be accomplished with HttpWebRequest/Response that can not be accomplished with WebClien...

How to get the webpage source code using C#

ok. I know about the WebRequest and the WebResponse objects. The problem is that i do not really want to get the source code of the webpage, i only want to check to see if the link exists or not. The thing is, if i use the GetResponse method, it goes an pull the entire soource code of the site. i am creating a broken link checker wit...

HttpWebRequest GetResponse delay on 64bit Windows

Hello, I recently tried running a .NET application on 64bit versions of Windows and was surprised to notice that all my HttpWebRequest.GetResponse() calls to web services on my local network were talking huge (around 500ms) time to complete. Here's a few info regarding my test setup: .NET 3.5 Windows Vista Home Premium 32bit, Windows...

HttpWebRequest not passing Credentials

I'm trying to use HTTPWebRequest to access a REST service, and am having problems passing credentials in, see code below. I've read that NetworkCredential doesn't support SSL, and I'm hitting an https site. Does anyone know of a class similar to NetworkCredential that does support SSL? Uri requestUri = null; Uri.TryCreate("http...

HttpPostRequest Text+File in vb.net

Hi, HttpPostRequest with Files only in VB2008 is easy: Using wc As New System.Net.WebClient() wc.UploadFile("http://server.de/exemple.php", "c:\test.png") End Using But I want POST Text + Files in one POST (username, password, file). But, how to? ...

HttpWebRequest Class Text + File in Vb.net

How to create an POST with the HttpWebRequest Class in VB.net (2008)? I can find exemples with text only but not with text and files. Thanks. ...

How to add Category in DotClear blog with HttpWebRequest or MetaWeblog API

I'm trying to create/modify dotclear blogs. For most of the options, i use XmlRpc API (DotClear.MetaWeblog). But didn't find any way to handle categories. So I start to look at the Http packet and try to do "the same as the browser". Here si the method I use to "Http POST" protected HttpStatusCode HttpPost(Uri url_, string data_...

WebResponse to HttpResponseBase. Is it possible?

Hi, In a controller action, I am manually sending a form to a remote URL using WebRequest. I successfully receive a WebResponse containing an html page to display. I would like to "paste" this response as the Response (of type HttpResponseBase) of the action. An action normally returns an ActionResult, so how do I conclude my controller...

Avoiding 504 on remote server .NET

I am using HttpWebRequest to download a remote file, however i get a 504 error. I pasted the url in firefox and the first and 3rd try it took 16seconds, the 2nd nothing happened (it looked like it timed out). How do i decrease the 504 error? Would changing HttpWebRequest timeout help? should i attempt to retry the file (lets say 3 times...

Set proxy data for an app

I have a few .NET apps which use the HttpWebRequest. My gut says i can create a config or manifest file and set the proxy data in there and .NET will automatically load it. But i dont know if that exist and if my gut is wrong. Is there a way to set the proxy data for my apps? Can i do the same for my one app that uses the ie browser con...