Gardelin
Gardelin

Reputation: 1071

Windows phone 8.1 POST x-www-form-urlencoded not working

I'm trying to send POST x-www-form-urlencoded request payway payment api in C#.

This is my code:

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, new Uri(url));
List<KeyValuePair<string, string>> bla = new List<KeyValuePair<string, string>>();
bla.Add(new KeyValuePair<string, string>("id_number","2000"));
request.Content = new HttpStringContent(new HttpFormUrlEncodedContent(bla).ToString(),Windows.Storage.Streams.UnicodeEncoding.Utf8, "application/x-www-form-urlencoded");

Api returns me status code 100 which stands for "wrong id_number".

I also tried to send POST via Postman and there works fine.

POST /services/test HTTP/1.1
Host: example.tk
Cache-Control: no-cache
Postman-Token: c67b2ee3-6e25-7ecc-61f5-38282c23sds7d
Content-Type: application/x-www-form-urlencoded

id_number=2000

Can someone know what am i missing?

Upvotes: 2

Views: 169

Answers (1)

aquila_cro
aquila_cro

Reputation: 176

use NavigateToString("") and add html form inside and post it :D

Upvotes: 1

Related Questions