Request ... get Response ... and Post back ?

  • Thread starter Thread starter Taggy
  • Start date Start date
T

Taggy

hi,
Can someone help me with this.
I am having this codes:

WebRequest myRequest = WebRequest.Create( myurl ); -line1
WebResponse myResponse = myRequest.GetResponse(); -line2
......
to get a reply from a webserver.
The reply is actually a form with a textbox and a button.
Can i simulate filling up the textbox and submit the form to get another
reply from the server ?

I assume after line2, my codes should already have a "session/connection"
with the webserver now, can i post back to the server to get another reply ?
(eg. myurl?x=1)

Thanks & Regards
Taggy
 
Hi Taggy:

Yes, you will have to simulate a POST back operation by writing data
into the request stream with the names and values of input elements
inside the form (the textbox and button). There are some examples to
download here:
http://support.microsoft.com/kb/q303436/

If you need to track cookies across the different requests, create a
new instance of the CookieContainer class and assign it to the
CookieContainer property of the requests.
 
Back
Top