title: How can I get the status code of a post to my web api
body: <p>So I have a URL on my box that when I post to it with a JSON object ("username, password, and applicationId")  it will return the status code 200, 400, 505, etc...  When I post to the url with Chromes Advanced Rest Client, everything works fine.  So I decided to create a single page web app project that would have a login that would post to this url.  Now my problem is that I can't figure out how to get the response status code.  Everytime I send off the request it hits dispose so I can't get to the status code of the response.</p>
  
  <p>I am losing my mind trying to figure out a way to get the response's status code.  What exactly do I have to do in order to get a hold of the status code.  So far I have tried using WebClient, HttpWebRequest, and HttpRequest.  All of these ended up in the disposed and I couldn't get to the response. I am not really sure what to do at this point.  If you can point me in the right direction it would be greatly appreciated.</p>
  
  <pre><code> public class ValidationController : ApiController
  {
      // POST api/account
      /// &lt;summary&gt;
      /// This will return a 200 and a JWT token if successful
      /// &lt;/summary&gt;
      /// &lt;param name="value"&gt;Json '{"Username":"[your_username]", "Password":"[your_password]","Application":"[your_application_name]"}'&lt;/param&gt;
      /// &lt;returns&gt;OnSuccess 200 and JWT token, OnFailure 401 and nothing else&lt;/returns&gt;
      public HttpResponseMessage Post([FromBody]Login login)
      //public HttpResponseMessage Post([FromBody]string value)
      {
          //var login = new Login();
          if (Request.RequestUri.Scheme != "https")
          {
              return Request.CreateResponse&lt;string&gt;(HttpStatusCode.HttpVersionNotSupported, "Authentication Failed.  Must use HTTPS.");
          }
          if (login == null)
          {
              return Request.CreateResponse&lt;string&gt;(HttpStatusCode.BadRequest, "The login piece is null");
          }
          if (Authenticate(login) == "-1")
          {
              return Request.CreateResponse&lt;string&gt;(HttpStatusCode.Unauthorized, "Authentication Failed");
          }
          return CreateToken(login);
      }
  </code></pre>
  
  <p>}</p>