title: jquery post error when using .NET HttpListener
body: <p>I have javascript on a html page without a webserver (file://). On the page I have javascript that does this</p>
  
  <pre><code>$.post("http://localhost:1234/", json_data ).fail(function(){alert('Fail');});
  </code></pre>
  
  <p>This worked fine without the <code>.fail</code>. I need to send the data to my .NET app. But I'd like to get an alert when it fails for some reason (like forgetting to launch the app). But when I add the <code>.fail</code> I get it 100% of the time even if my .NET code sees the commend and runs as expected. The below is the .NET code. Why do I get an error/fail? I tried looking at the error message it was simply "error". I tried looking at the response in firebug and I couldnt see the response although I could see the response length and the server (some MS/.NET header like MS HTTP API)</p>
  
  <pre><code>HttpListener listener = new HttpListener();
  listener.Prefixes.Add("http://localhost:9001/");
  listener.Start();
  //...
  HttpListenerContext context = listener.GetContext();
  
  HttpListenerRequest request = context.Request;
  var data = new StreamReader(request.InputStream).ReadToEnd();
  //...
  HttpListenerResponse response = context.Response;
  
  string responseString = @"{""command"":""Success""}";
  byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
  
  response.ContentLength64 = buffer.Length;
  System.IO.Stream output = response.OutputStream;
  output.Write(buffer, 0, buffer.Length);
  </code></pre>