Please see the following code:
objCookieContainer = new CookieContainer();
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://website.com/login.php?user=xxx&pass=xxx");
request.Method = WebRequestMethods.Http.Get;
request.Timeout = 15000;
request.Proxy = null;
request.CookieContainer = objCookieContainer;
HttpWebRequest newRequest = (HttpWebRequest)WebRequest.Create("http://website.com/page.php?link=url");
newRequest.Method = WebRequestMethods.Http.Get;
newRequest.Timeout = 15000;
newRequest.Proxy = null;
newRequest.CookieContainer = objCookieContainer;
HttpWebResponse response = null;
response = (HttpWebResponse)request.GetResponse();
string readerRequest = new StreamReader(response.GetResponseStream(), Encoding.UTF8).ReadToEnd();
response = (HttpWebResponse)newRequest.GetResponse();
string readerNewRequest = new StreamReader(response.GetResponseStream()).ReadToEnd();
After the using the request.GetResponse(), the cookie is populated with data successfully and it have it's authentication code and the readerRequest is populated too, after that i call the newRequest.GetResponse() but the readerNewRequest is empty, i tried to do many things but always same result, the only way i have solved this is by using a WebBrowser object in which i pass the url and i was able to get the content using the WebBrowser.DocumentStream.
How can i solve this ?