What is the difference between 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 … Read more

.Net HttpWebRequest.GetResponse() raises exception when http status code 400 (bad request) is returned

I am in a situation where when I get an HTTP 400 code from the server, it is a completely legal way of the server telling me what was wrong with my request (using a message in the HTTP response content) However, the .NET HttpWebRequest raises an exception when the status code is 400. How … Read more

How to post JSON to a server using C#?

Here’s the code I’m using: // create a request HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url); request.KeepAlive = false; request.ProtocolVersion = HttpVersion.Version10; request.Method = “POST”; // turn our request string into a byte stream byte[] postBytes = Encoding.UTF8.GetBytes(json); // this is important – make sure you specify type this way request.ContentType = “application/json; charset=UTF-8”; request.Accept = “application/json”; … Read more

Getting Http Status code number (200, 301, 404, etc.) from HttpWebRequest and HttpWebResponse

I am trying to get the HTTP status code number from the HttpWebResponse object returned from a HttpWebRequest. I was hoping to get the actual numbers (200, 301,302, 404, etc.) rather than the text description. (“Ok”, “MovedPermanently”, etc.) Is the number buried in a property somewhere in the response object? Any ideas other than creating … Read more

The request was aborted: Could not create SSL/TLS secure channel

We are unable to connect to an HTTPS server using WebRequest because of this error message: The request was aborted: Could not create SSL/TLS secure channel. We know that the server doesn’t have a valid HTTPS certificate with the path used, but to bypass this issue, we use the following code that we’ve taken from … Read more