Submitting an HTML form within c#
-
I am writing a c# windows application and want it to fill out a simple HTML form, submit the form, and return the content of the returned webpage. Is this possible? I know how to use WebRequest and WebResponse to retrieve the content of a specific webpage, but I can not figure out how to retrieve the content of a webpage accessed by submitting a form. Here's what the form looks like for some more info:
Name: Address? input type="text" size="40" name="address"> City?
-
I am writing a c# windows application and want it to fill out a simple HTML form, submit the form, and return the content of the returned webpage. Is this possible? I know how to use WebRequest and WebResponse to retrieve the content of a specific webpage, but I can not figure out how to retrieve the content of a webpage accessed by submitting a form. Here's what the form looks like for some more info:
Name: Address? input type="text" size="40" name="address"> City?
Take a look at the HttpWebRequest.GetRequestStream[^] for
HttpWebRequest.GetRequestStream
which shows a good example of sending a POST request to a CGI sitting off on some web server. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog] -
Take a look at the HttpWebRequest.GetRequestStream[^] for
HttpWebRequest.GetRequestStream
which shows a good example of sending a POST request to a CGI sitting off on some web server. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog] -
I think you meant to point to the example in the HttpWebRequest.GetRequestStream documentation. Also an example of the HTTP POST and some of the offical documentation about the format of the POST body might help explain the Microsoft example.
I messed up the links in the reply. These are the links that I meant to use. HttpWebRequest.GetRequestStream Example of the HTTP POST Offical documentation about the format of the POST body