I'm trying to get HTML code from a specific webpage, but when I do it using
HttpWebRequest request;
HttpWebResponse response;
StreamReader streamReader;
request = (HttpWebRequest)WebRequest.Create(pageURL);
response = (HttpWebResponse)request.GetResponse();
streamReader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("windows-1251"));
htmlCode = streamReader.ReadToEnd();
streamReader.Close();
or using WebClient, I get redirected to a login page and I get its code. Is there any other way to get HTML code?
I read some information here: How to get HTML from a current request, in a postback , but didn't understand what should I do, or how and where to specify URL.
P.S.: I'm logged-in in a browser. Notepad++ perfectly gets what I need via "right click - view source code".
Thanks.