I want to download webpage code (plug.dj) and paste it into string. It is not hard but when I test my program an error appeared.
The remote server returned an error: (401) Unauthorized.
I think I cannot download code because I am not logged on this website. I tried add credentials into my code but I have no idea how it should looks like. User can log in with Google, Facebook or Twitter.
My code:
WebRequest request = WebRequest.Create("http://plug.dj/drum-bass/");
request.Credentials = new NetworkCredential (**Here should be username**, **Password**);
request.Method = "GET";
WebResponse response = request.GetResponse();
Stream stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);
string content = reader.ReadToEnd();
reader.Close();
response.Close();
Know someone how to solve this?
I got idea how to solve it but I dont know if it is realisable. Maybe could this program using data of web browser and get this information by this way.