Im trying to send a get request and get the content of a webpage. i have these code.
string url = "www.google.com";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)response.GetResponse();
I found these codes from many site and it is correct but "GetResponse" is giving error. Its explanation below.
Is it a problem of Visual Studio 2012 ? It cant find GetResponse method and just find GetResponseStream
method when I press G.
I tried to do this with WebClient class but WebClient cannot be found also. Do these problems occur because of Visual Studio 2012? or any reason ?
Error 1 'System.Net.HttpWebResponse' does not contain a definition for 'GetResponse' and no extension method 'GetResponse' accepting a first argument of type 'System.Net.HttpWebResponse' could be found (are you missing a using directive or an assembly reference?) C:\Users\abidinberkay1\documents\visual studio 2012\Projects\App1\App1\BlankPage1.xaml.cs 45 66 App1