title: How to add the Content-Length,Content-Type and Last-Modified to the HTTP Response Message Header
body: <p>How to add the Content-Length,Content-Type and Last-Modified to the HttpResponseMessage  Header using .net.</p>
  
  <p>I need to append the all these values manually to the response after adding these fields i need to return the response from the server.
  I have tried to adding these fields in fallowing way </p>
  
  <pre><code>httpResponse.Content.Headers.Add("Content-Length", item.Size.ToString());
  httpResponse.Content.Headers.Add("Content-Type", item.ContentType);
  </code></pre>
  
  <p>But it throwing the exception as </p>
  
  <blockquote>
    <p>"Object reference not set to an instance of an object".</p>
  </blockquote>
  
  <p>If i am adding like this</p>
  
  <pre><code>httpResponse.Headers.Add("Content-Length", item.Size.ToString());
  httpResponse.Headers.Add("Content-Type", item.ContentType);
  </code></pre>
  
  <p>I am  getting the fallowing error</p>
  
  <blockquote>
    <p>"Misused header name. Make sure request headers are used with
    HttpRequestMessage, response headers with HttpResponseMessage, and
    content headers with HttpContent objects."</p>
  </blockquote>
  
  <p>Please any one help me to add these fields to the HttpResponsesMessage .  </p>