title: post request to Rest Api with c# and httpclient
body: <p>There is such code:</p>
  
  <pre><code>var client = new HttpClient();
  var postData = new List&lt;KeyValuePair&lt;string, string&gt;&gt;();
  postData.Add(new KeyValuePair&lt;string, string&gt;("username:", " 1"));
  postData.Add(new KeyValuePair&lt;string, string&gt;("password:", " 1"));
  
  HttpContent content = new FormUrlEncodedContent(postData);
  
  HttpResponseMessage response = await client.PostAsync(
      "http://libdiary.liberty-lab.ru/api/v1/login", 
      content);
  
  string result = await response.Content.ReadAsStringAsync();
  return result;
  </code></pre>
  
  <p>He must make a post request to the server. The project is windows phone. 
  Feature on the server that is responsible for this query looks like (Python):</p>
  
  <pre><code>def log_in(request):
      username = request.META['HTTP_USERNAME']
      password = request.META['HTTP_PASSWORD']
      user = auth.authenticate(username=username, password=password)
  
      if user is not None:
          auth.login(request, user)
          content = json.dumps('Your welcome dear user!')
          return HttpResponse(content, content_type='application/json')
      else:
          content = json.dumps('Sorry! Please, check your name or password.')
          return HttpResponse(content, content_type='application/json')
  </code></pre>
  
  <p>However, attempts to access a windows phone always an <code>error:INTERNAL SERVER ERROR</code> and in the application code returned http page with an <a href="http://libdiary.liberty-lab.ru/api/v1/login" rel="nofollow">error on this page</a>. Could you tell what the problem is? Perhaps I am wrong to send data, can you suggest how to do it right?</p>