httpwebrequest

C# HttpWebRequest vs WebRequest

I saw this piece of code: var request = (HttpWebRequest) WebRequest.Create("http://www.google.com"); Why do you need to cast (HttpWebRequest)? Why not just use HttpWebRequest.Create? And why does HttpWebRequest.Create make a WebRequest, not a HttpWebRequest? ...

What is the equivalent to ASP.NET's HttpContext.Current.Items in Classic ASP?

The title says it all really, but to clarify what HttpContext.Current.Items is, it's a store that has a life span of the HTTP request. I'd like to know the Classic ASP equivalent of this. ...

C# HttpWebRequest - How to disgtinguish between HTML and XML pages without downloading ?

I need to be able to tell if a link (URL) points to an XML file (RSS feed), or a regular HTML file just by looking at the headers, or something similiar (without downloading it) Any good advice for me there ? :) Thanks! Roey ...

Using HTTPWebRequest in ASP.NET VB

I don't have any idea how to use this class in .net. Anyone wants to share his knowledge how to implement and use this class? Have you got any simple procedure that calls a page and process it? ...

"The format of the URI could not be determined" with WebRequest

I'm trying to perform a POST to a site using a WebRequest in C#. The site I'm posting to is an SMS site, and the messagetext is part of the URL. To avoid spaces in the URL I'm calling HttpUtility.Encode() to URL encode it. But I keep getting an URIFormatException - "Invalid URI: The format of the URI could not be determined" - when I us...

Is there a URL builder that supports request paramater concatenation as well?

I want to achieve something like the following: UrlBuilder ub = new UrlBuilder("http://www.google.com/search"); ub.Parameters.Add("q","request"); ub.Parameters.Add("sourceid","ie8"); string uri = ub.ToString(); //http://www.google.com/search?q=request&sourceid=ie8 Is there anything in .NET, or I will have to create my own? ...

Making http request in J2ME

I'm maintaining a J2ME application where I found a http request to http://www.google.com in application initialization. I asked the developer why there is a request to google. He said that this way the other requests that the application makes would be faster. I removed this request to google.com and the other requests got slower. Can ...

SSL HttpWebRequest to site with mismatched certificate on Azure?

We have a client with mismatched SSL certificates in their QA environment. We’re making HttpWebRequest calls to those SSL-protected web resources from within an Azure web role. To get around their certificates, we set ServicePointManager.CertificatePolicy to a new policy that accepts all certificates. This works in a full trust enviro...

Stream a WAV File From The Web In Silverlight 3

I've managed to discover Gilles Khouzam's playback implementation for WAV files in Silverlight 3 and while that would be the majority of the battle, I'm stuck on a final detail: how do I pull a wav file from the web some place and then feed it into his WaveMediaStreamSource for playback? Here's the closest I've come: public MainCon...

WebClient multi-threaded response

Hi, I am performing two parallel requests to my web service using WebClient and multithreading them with ThreadPool. However, I'm having an issue in one of the threads where I get this WebException: The server committed a protocol violation. Section=ResponseStatusLine I did some research and found that it could be an unsafe header...

C# read image object in to web request

Hey, I'm currently trying to send an image file to a web server using a web request, a memory stream and an image object. This is my current method for sending the request: public void Send(Image image) { //Assign the request here too, just in case Request = (HttpWebRequest)WebRequest.Create(FormURL); R...

Conversion of VB6 HTTP request to VB.Net 2.0

I'm attempting to update a legacy VB6 component (not written by me) to the .NET platform. There is one function which posts an XML string to a URL: Function PostToUrl(ByRef psUrl, ByRef psData, Byref psResponseText, ByRef psErrorMsg, ByRef psUsername, ByRef psPassword) On Error Resume Next Dim objWinHTTP PostToUrl = False psError...

How to send an HTTPS GET Request in C#

Related: how-do-i-use-webrequest-to-access-an-ssl-encrypted-site-using-https How to send an HTTPS GET Request in C#? ...

HttpWebRequest over SSL with client credentials

I'm trying to use HttpWebRequest to get an https URI that requires a username and password. If I put the URI into a browser it pops up a dialog asking for credentials and then works. Using HttpWebRequest gives me a 401 Unauthorized error. The documentation for NetworkCredentials says it doesn't support SSL, but I can't find what I'm sup...

Download a file from the internet using java : How to authenticate?

Hi, Thanks to this thread http://stackoverflow.com/questions/921262/how-to-download-and-save-a-file-from-internet-using-java I know how to download a file, now my problem is that I need to authenticate on the sever from which I'm dowloading. It's an http interface to a subversion server. Which field do I need to look up into ? Using th...

C# MultiThreaded HttpWebRequest timeouts.. Help!

Hi all. I have implemented a multithreaded crawler in C#. Using a custom threadpool, there's a job queue, all pages to be downloaded are queued up and each thread takes one and downloads. using 15 threads, When crawling one site only, it's smooth as silk and gets done fast. When crawling several sites on different servers at the sam...

Using HttpWebRequest to download html pages returns ContentLength as -1

Hi, I'm trying to get a bunch of HTML files downloaded from the internet and using HttpWebRequest to do it. However when I use WebRequest.Create("http://www.stackoverflow.com/"); WebRequest.GetResponse(); The HttpWebResponse.ContentLength is always -1. I have to show the progress of these pages downloading, in our existing VB6 versi...

PHP - HTTP Post - incorrect headers

Hi I'm currently trying to post an xml file to an external server, but I'm getting a response back that the headers are incorrect. The server I'm posting requires some headers and I'm wondering if they're in the correct format or if there are any other "standard" headers that need to be included? My code is: <?php function httpsPost($...

How Create a .NET HttpWebRequest class from a Socket's recieved byte[]'s

Hi all, I have a socket that is receiving HTTP requests. So I have a raw http request in byte[] form from my socket. I have to study this request - BUT Instead of reinventing the wheel - can I 'cast' this byte array into a System.Net.HttpWebRequest or something similar? Thanks! ----- UPDATE --------- So anyway I couldn't find the ...

http post + digital certificate required.

Hi, I want to post some xml to an external server and have been told that: "The transmission protocol used is https (SSL). This requires that your initiating server has a valid digital certificate." Where do I get one of these? I have a Thwate Personal Email Certificate but not sure if that would do? Thanks, ...