简体   繁体   中英

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?

使用 NavigateToString("") 并在里面添加 html 表单并发布它:D

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM