This code is in python
dataParams = urllib.urlencode({
"name": "myname",
"id": 2,
})
dataReq = urllib2.Request('mylink', dataParams)
dataRes = urllib2.urlopen(dataReq)
Now i am trying to convert it into C#.Till now I have been able to do this only
var dataParams = new FormUrlEncodedContent(
new KeyValuePair<string, string>[]
{
new KeyValuePair<string, string>("name", myname"),
new KeyValuePair<string, string>("id", "2"),
});
httpResponse = await httpClient.PostAsync(new Uri(dataString),dataParams);
httpResponseBody = await httpResponse.Content.ReadAsStringAsync();
But my problem is posting the content since the post data needs to be both int and string.But I am able to only send data in string format using FormUrlEncodedContent.So how do I send the post request with proper parameters.