Hi folks, I have a pratical question here. I have to access to a site and get the cookies information to reuse it in subsequent navigation. I don't have any browser control on my side, because everything is supposed to run on a server. With some site the task is pretty easy, but there are some site that send back cookies in a way I cannot manage to intercept.
On example is Italian highways site: I can't understand how they sent back cookies and most important, how can I capture those cookies from a .Net application.
I've tried both WebClient object, looking into header, in this way:
var wc = new WebClient();
var htmlMainPage = wc.DownloadString(new Uri(AutostradeMainSite));
string cookies = wc.ResponseHeaders["Set-Cookie"];
but I don't get any result. Even by looking into header, there's no cookies there.
Then I tried with HttpWebRequest object, but I wasn't able to retrieve the cookies:
HttpWebRequest wr = (HttpWebRequest)HttpWebRequest.Create(AutostradeMainSite);
wr.Method = "GET";
HttpWebResponse response = (HttpWebResponse)wr.GetResponse();
var cookies = response.Cookies
What am I doing wrong?
Analyzing the main page of the site with some developer tools for IE or Chrome, I can see that some cookies are sent to the browser, but I cannot see them neither in the header, nor in the javascript... How can it work? Thanks in advance for any help.