L
Luis Esteban Valencia Muñoz
I'm working on a web scraping application that needs to log into a website
before it can get the data to scrape. I've always been confused about how
the HttpWebRequest and HttpWebResponse objects work together with cookies,
and was hoping that someone here could clear it up for me!
Here's the steps I need to accomplish:
1) Set two cookies containing information I already have
2) Request the login page URL, and save a third cookie that is given to me
from that page
3) Submit a form via POST, along with the 3 cookies
4) Save a fourth cookie that is set after the form is submitted with valid
information
I don't need the entire code to do this, but rather some help with the order
to do it. Do I create a request and THEN set the cookies? Can I use the
same CookieContainer for each request? If someone could point me in the
right direction it would be greatly appreciated!
before it can get the data to scrape. I've always been confused about how
the HttpWebRequest and HttpWebResponse objects work together with cookies,
and was hoping that someone here could clear it up for me!
Here's the steps I need to accomplish:
1) Set two cookies containing information I already have
2) Request the login page URL, and save a third cookie that is given to me
from that page
3) Submit a form via POST, along with the 3 cookies
4) Save a fourth cookie that is set after the form is submitted with valid
information
I don't need the entire code to do this, but rather some help with the order
to do it. Do I create a request and THEN set the cookies? Can I use the
same CookieContainer for each request? If someone could point me in the
right direction it would be greatly appreciated!