I am trying to submit a form (via WebClient - C# WindowsForms) but I do not get it yet.
My HTTP page sequence is: Username_Form > Password_Form > Download PDF File
<!-- Username_Form.html -->
<form ... action="/AgenciaWeb/autenticar/autenticar.do">
<input type="text" name="username" />
<input type="submit" value="Continue" />
</form>
<!-- Password_Form.html -->
<form ... action="/AgenciaWeb/autenticar/validarSenha.do">
<input type="password" name="password" />
<input type="submit" value="Login" />
</form>
<!-- Password_Form.html -->
<div>
<a href="PDF_download.pdf">Download</a>
</div>
So I should fill all forms in the first page to be redirected to second page to also fill all forms and then to get the final page and start to download my PDF File.
The problem is that I am not getting the submit in the first page. I am doing:
private void button1_Click(object sender, EventArgs e)
{
var url = "http://test_something.com:8080/AgenciaWeb/autenticar/autenticar.do";
using (var client = new WebClient())
{
var values = new NameValueCollection();
values["username"] = "user01";
var response = client.UploadValues(url, "POST", values);
var responseString = Encoding.Default.GetString(response);
Console.WriteLine(responseString);
}
}
However my 'responseString' is the exactly same page with all forms filled (input type="text" name="username" value="user01") and the submit does not happen, like I can not see or interact with the second page (Password_Form.html).
Is there something wrong that I am missing?