WebRequest/WebResponse classes

  • Thread starter Thread starter Ziphyre
  • Start date Start date
Z

Ziphyre

Hi,

I'm quite new in C# so it can be a silly question, but i can't figure
how to make a req/resp and a second req with first response's
informations... What I mean:

I have no problem in sending a request to a web server, and getting
response from it, reading headers, cookies, body etc... but how can i
make a seconde request using the first communication with HttpWebRequest
and HttpWebResponse.

What exactly i am trying to do is:
connect to the server X,
get a response and cookie information,
send username email and password to X/login.php with POST data and
appropriate cookies...
get a OK message,
just 4 step


thanks a lot


PS: any tutorial about the subject would be appreciated
 
For cookies, you need to instantiate a CookieContainer class and
assign the object to the CookieContainer property of all the
WebRequest object needing to share the cookies.

As for the rest of the response, do you need data inside of input
fields to POST back? The only way to really do this is to scrape it
out using RegEx or String.IndexOf.

I have some examples here:
http://odetocode.com/Articles/162.aspx
 
Thanks,
useful examples...


Scott said:
For cookies, you need to instantiate a CookieContainer class and
assign the object to the CookieContainer property of all the
WebRequest object needing to share the cookies.

As for the rest of the response, do you need data inside of input
fields to POST back? The only way to really do this is to scrape it
out using RegEx or String.IndexOf.

I have some examples here:
http://odetocode.com/Articles/162.aspx
 
Back
Top