WebRequest/WebResponse classes

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
 
S

Scott Allen

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
 
Z

Ziphyre

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top