I'm trying to submit a form on a web page programmatically. I'm practicing on the comment form of my Wordpress website: http://www.smortazavi.com/games/before-eternity/contact/
And here is the code based on this post:
private async void button_Click(object sender, RoutedEventArgs e)
{
using (var client = new HttpClient())
{
var values = new Dictionary<string, string>
{
{ "g16-name", "hello" },
{ "g16-email", "myemail@hotmail.com" },
{"g16-comment", "comment" }
};
var content = new FormUrlEncodedContent(values);
var response = await client.PostAsync("http://www.smortazavi.com/games/before-eternity/contact", content);
var responseString = await response.Content.ReadAsStringAsync();
}
MessageBox.Show("Done!");
}
When I run the code, the responseString contains the populated form inputs, but the form is not actually submitted.
Could you say what am I missing here?