httpwebrequest

Where to find HTTP methods examples?

HTTP defines eight methods (sometimes referred to as "verbs") Can you help me find examples for each one so I can test and understand them better? ...

POST request message to a URL takes abnormal time

Hello, I am trying to POST to a URL on the click of a button (to enable trigger pulse of the camera). I have a similar code to disable trigger pulse on the click of a button. The problem i face is that there is an abnormally high delay for the action to get completed. I could not figure out why it completes early sometimes and takes ...

Simple HttpWebRequest over SSL (https) gives 404 Not Found under C#

Hi, I want to make a POST to a php-written Web Service that sits on a secure connection. The following code is just a test console app I wrote after a few hours of trial and error. Essentially, I found out a few different methods to use HttpWebRequest, but all of them are the same thing. Testing my URI with 'http' on a web browser, sh...

ASP.NET Base64 string corruption

I am passing an object from one asp.net page to another. I'm encoding the object as a Base64 string and passing it as a POST parameter. However, when the receiving page reads the POST value, if there is a + sign in the Base64 string, it is being replaced with a line break. For example: ...AABDEDS+DFEAED... becomes ...AABDEDS DF...

C# HttpWebReqest - escape POST content?

When I've uploaded content from my C# app to a website in the past, I've used a POST request like so: HttpWebRequest wr = (HttpWebRequest)WebRequest.Create("http://" + this.server + "/log.php"); wr.Method = "POST"; wr.ContentType = "application/x-www-form-urlencoded"; string paramString = "v=" + this.version + "&m=" + th...

How to see request in fiddler to my site and from my site iis 5

Hi i have webserver on windows xp iis 5 sp3. I see logs but thre are only url to my site. But i need see all request informations(headers an body) For example I go to GMAIl and i click search rss feed(i add my own rss) And gmail need send request to my own webserver 13:01:05 74.125.16.68 GET /9.rss 200 (it send request and i saw log). I ...

Posting using POST from C# over https

Hi, After wasting two days with this question (and trying to make it work), I've decided to take a step back and ask a more basic question, because apparently there's something I don't know or I'm doing wrong. The requirements are simple, I need to make an HTTP post (passing a few values) over https from C#. The website (if given the...

How to get HttpWebRequest.AllowAutoRedirect to set the cookies when doing a GET/POST on the redrected page?

Is there a way to get the HttpWebRequest object to take the set-cookie header into account when being automatically redirected to another page through the AllowAutoRedirect feature? I need it to maintain the cookie information across redirects; I'd rather not have to implement the redirect myself if the framework can do this for me. This...

C# - How to read a continuous stream of XML over HTTP

I am trying to figure out the best way to consume a continuous stream of XML data from a service that is sending the data as a "constant" feed over HTTP. I was considering using HttpWebRequest/Response but I am not sure how that will behave if the data just continuously streams. Any thoughts? ...

Flex slow first Http request

Hi, When i use loader.load(request); for the first time, my flex freeze for 10 secondes before posting the data (i can see the web server result in real time). However if redo a similar POST with other data but same request.url, it's instantaneous. // Multi form encoded data variables = new URLVariables(); variables.user = "aaa"; variab...

How to download an image from web showing the progress of the download in c# using winforms?

I download an image from an URL asynchronously using WebRequest this way: public void Download(string url) { byte[] buffer = new byte[0x1000]; WebRequest request = HttpWebRequest.Create(url); request.Method = "GET"; request.ContentType = "image/gif"; request.BeginGetResponse(result => { WebRequest webRequest = result...

Problem making XML RPC call

I'm trying isolate a problem I'm having making an XML RPC call: XDocument doc = new XDocument(); doc.Add(new XElement("methodCall", new XElement("methodName", "send"), new XElement("params", new XElement("param", new XElement("value", new XElement("string", this.ApiKey))), new XElement("param", new XElement("value", n...

ASP.NET Request - Can I get a posted file from a dynamic control created on client?

Hello, I have a web control with some custom javascript. The javascript creates new file upload controls on the client dynamically using code similar to: var newFileUpload = document.createElement('input'); newFileUpload.type = 'file'; container.appendChild(newFileUpload); // where container is a div This exists in an ASP.NET form wi...

How to get operating IP Address of the WEB instance on IIS7

Hi, I have Vista x64 IIS7 running on my dev. machine. I used to use Request.ServerVariables.Get("LOCAL_ADDR") to get the operating instance IP address of the website which was resolving into like 192.168.1.89, however after switching to Vista & IIS7, I started to get ::1 which people say that it is IPv6. How can I get it the old way?...

Not generating a complete response from a HttpWebResponse object in C#

I am creating a HttpWebRequest object from another aspx page to save the response stream to my data store. The Url I am using to create the HttpWebRequest object has querystring to render the correct output. When I browse to the page using any old browser it renders correctly. When I try to retrieve the output stream using the HttpWeb...

GET request with query and digest http authorization

I have java service that I need to use (can't modify it) and web server that uses digest HTTP authorization. I'm using HttpWebRequest to communicate with the server (with GET method). NetworkCredentials needed for authentication are provided. But invoking GetResponse() generates error 400 (Bad request). Address: http://info.server.com/s...

Should I RESTify my RPC calls over HTTP?

We have HTTP webservices that are RPC. They return XML representing the object the either retrieved or created. I want to know the advantages (if any) of "restifying" the services. POST http://www.example.com/createDoodad GET http://www.example.com/getDoodad?id=13 GET http://www.example.com/getWidget?id1=11&id2=45 POST http://ww...

HttpWebRequest and SSL in .NET CF 3.5

We're making some calls to some very simple JSON web services in .NET CF 3.5 / Windows Mobile 6 and it appears that we've run into this bug: http://blogs.msdn.com/andrewarnottms/archive/2007/11/19/why-net-compact-framework-fails-to-call-some-https-web-servers.aspx Is it really almost two years later and this isn't fixed? Seems like a pr...

Detecting which version of IE is installed on your OS in C#?

I am currenting manintaining a windows service that programmatcially generates a HttpWebRequest and HttpWebResponse objects for retrieving the response message of the request. The UserAgent property of the HttpWebRequest was hard coded to use IE 6 as the browser agent. Is the a way to programmatcially detect which version of IE is inst...

HttpWebRequest to URL with dot at the end

Hi, when i do a GET with WebRequest.Create("http://abc/test.") i get 404 because according to fiddler the trailing dot gets stripped away by .NET and the web server needs the dot. how can i prevent that or work around it. any workaround is appreciated! ...