I am trying to connect to an API that has given me the log in example of:
POST /api/login
Host: nephele.qtestnet.com
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
j_username= maxmccloud%40qasymphony.com&j_password=p@ssw0rd
I tried to implement this as:
class QTestDriver
{
HttpClient http = new HttpClient();
public QTestDriver()
{
http.BaseAddress = new Uri("http://ahpra.testnet.com");
}
public async void Login()
{
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "/api/login");
request.Headers.CacheControl = new CacheControlHeaderValue() { NoCache = true };
request.Content = new StringContent("j_username=scott&j_password=xxxx", Encoding.UTF8, "application/x-www-form-urlencoded");
HttpResponseMessage resp = await http.SendAsync(request);
}
}
However the response I get is
"StatusCode: 463, ReasonPhrase: 'Unknown', Version: 1.0, Content: System.Net.Http.StreamContent, Headers:\r\n{\r\n X-Cache: MISS from webtitan\r\n Proxy-Connection: close\r\n Date: Fri, 20 Mar 2015 05:04:32 GMT\r\n ETag: \"5501c94b-19c4\"\r\n Server: nginx/1.7.9\r\n Via: 1.0 webtitan (squid/3.0.STABLE26)\r\n Content-Length: 6596\r\n Content-Type: text/html\r\n}" string
I have googled this but can't find anything useful about Status 463.
HttpClientis part of .NET, not part of C#.