By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,771 Members | 1,448 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,771 IT Pros & Developers. It's quick & easy.

Auto complete a webform?

P: n/a
I have created a webpage with a webform (one testbox and one button). Now I
want to create a C# Windows Application that loads this webpage and auto
complete the form (in other words, fills the testbox with a given value and
invoke the button so the form is posted back to the webserver).

Is that possible? If so, please post a link or some simple code to
demostrate this behaviour.

Regards

PZ
May 17 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
It calls "screen scraping". I recomed to google for this, like
http://www.google.com/search?num=30&...creen+scraping

"Preben Zacho" wrote:
I have created a webpage with a webform (one testbox and one button). Now I
want to create a C# Windows Application that loads this webpage and auto
complete the form (in other words, fills the testbox with a given value and
invoke the button so the form is posted back to the webserver).

Is that possible? If so, please post a link or some simple code to
demostrate this behaviour.


--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

May 17 '06 #2

P: n/a
Hi,

Yes, you can , if you are using WebBrowser it does provide a Document
property from where you can access the web page.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Preben Zacho" <th**********************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
I have created a webpage with a webform (one testbox and one button). Now I
want to create a C# Windows Application that loads this webpage and auto
complete the form (in other words, fills the testbox with a given value and
invoke the button so the form is posted back to the webserver).

Is that possible? If so, please post a link or some simple code to
demostrate this behaviour.

Regards

PZ

May 17 '06 #3

P: n/a
We are you reading the webform at all?

You know the fields you want to fill, you know what you want to put in
them.

Cut to the chase, and just use System.Net.HttpWebRequest to send the
POST command to the web server.

(Taken from an MSDN example)
HttpWebRequest myHttpWebRequest =
(HttpWebRequest)WebRequest.Create("http://www.contoso.com/");

string postData="Name="+userName;

ASCIIEncoding encoding=new ASCIIEncoding();
byte[] byte1=encoding.GetBytes(postData);

myHttpWebRequest.ContentType="application/x-www-form-urlencoded";
myHttpWebRequest.Method="POST";

// Set the content length of the string being posted.
myHttpWebRequest.ContentLength=postData.Length;

Stream newStream=myHttpWebRequest.GetRequestStream();
newStream.Write(byte1,0,byte1.Length);

newStream.Close();

May 17 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.