Difference between Pragma and Cache-Control headers?

I read about Pragma header on Wikipedia which says: “The Pragma: no-cache header field is an HTTP/1.0 header intended for use in requests. It is a means for the browser to tell the server and any intermediate caches that it wants a fresh version of the resource, not for the server to tell the browser … Read more

Returning http status code from Web Api controller

I’m trying to return a status code of 304 not modified for a GET method in a web api controller. The only way I succeeded was something like this: public class TryController : ApiController { public User GetUser(int userId, DateTime lastModifiedAtClient) { var user = new DataEntities().Users.First(p => p.Id == userId); if (user.LastModified <= lastModifiedAtClient) … Read more

How to set HttpResponse timeout for Android in Java

I have created the following function for checking the connection status: private void checkConnectionStatus() { HttpClient httpClient = new DefaultHttpClient(); try { String url = “http://xxx.xxx.xxx.xxx:8000/GaitLink/” + strSessionString + “/ConnectionStatus”; Log.d(“phobos”, “performing get ” + url); HttpGet method = new HttpGet(new URI(url)); HttpResponse response = httpClient.execute(method); if (response != null) { String result = getResponse(response.getEntity()); … Read more

Why should I use IHttpActionResult instead of HttpResponseMessage?

I have been developing with WebApi and have moved on to WebApi2 where Microsoft has introduced a new IHttpActionResult Interface that seems to recommended to be used over returning a HttpResponseMessage. I am confused on the advantages of this new Interface. It seems to mainly just provide a SLIGHTLY easier way to create a HttpResponseMessage. … Read more

Proper way to return JSON using node or Express

So, one can attempt to fetch the following JSON object: $ curl -i -X GET http://echo.jsontest.com/key/value/anotherKey/anotherValue HTTP/1.1 200 OK Access-Control-Allow-Origin: * Content-Type: application/json; charset=ISO-8859-1 Date: Wed, 30 Oct 2013 22:19:10 GMT Server: Google Frontend Cache-Control: private Alternate-Protocol: 80:quic,80:quic Transfer-Encoding: chunked { “anotherKey”: “anotherValue”, “key”: “value” } $ Is there a way to produce exactly the … Read more