I'm working on a project that scrapes content from a page on Amazon.co.uk. I can submit the login form successfully and I store the cookies in a CookieContainer, everything appears normal and I am logged into the site successfully. However, when I browse to certain pages it appears logged out, prompting the login screen again. I can never access the page programmatically.
I think I might be falling into the bug reported here which relates to Cookie Container with subdomains on .NET 4: https://connect.microsoft.com/VisualStudio/feedback/details/771651/cookiecontainer-subdomain-handling-issue-in-net-4-0#
Two workarounds exist on this link:
Workaround #1: after receiving response with Version=1 cookies, add them to new CookieContainer as >plain cookies, and then use this new container to make subsequent requests.
Workaround #2: after receiving response with Version=1 cookies for parent domain, add them to same >CookieContainer once again, now for subdomain.
I'm not sure I understand how to implement this though, has anyone experienced this before that could share a solution with me? I'm running .NET 4.0.
Thanks, Colin.