This project is read-only.

Trouble with simple webrequest

Topics: Web Api
Sep 27, 2011 at 8:47 PM
Edited Sep 27, 2011 at 9:38 PM

I am trying to make an https request, but can't seem to get my content posted.

HttpRequestMessage m = new HttpRequestMessage();
m.RequestUri = new Uri(https://target website);
m.Method = HttpMethod.Post;
m.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic"this.Get64("my key"));

m.Content = string.Format("amount=25120&card={0}&currency=usd&description=test from tps", stripeToken);

//m.Properties.Add("currency", "usd");
//m.Properties.Add("card", this.Get64(stripeToken));
//m.Properties.Add("description", "test from tps");
//m.Properties.Add("amount", "25125");

 HttpClient client = new HttpClient();

HttpResponseMessage response = client.Send(m);
string qqq = response.Content.ReadAsString();
I am getting an error because my properties are not getting sent.
>>You should instead be sending an application/x-www-form-urlencoded body:
Any help on a simple example would be great.
Thanks, Terrence.