try this
string sVal = "http://www.w3schools.com/xml/note.xml";
XDocument document = XDocument.Load(sVal);
or
Uri url = new Uri("http://www.w3schools.com/xml/note.xml");
using (var wc = new WebClient())
{
string sss = wc.DownloadString(url);
}
if you are facing Security Issue
try this
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "GET";
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
// allows for validation of SSL conversations
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
WebResponse respon = req.GetResponse();
Stream res = respon.GetResponseStream();
string ret = "";
byte[] buffer = new byte[1048];
int read = 0;
while ((read = res.Read(buffer, 0, buffer.Length)) > 0)
{
Console.Write(Encoding.ASCII.GetString(buffer, 0, read));
ret += Encoding.ASCII.GetString(buffer, 0, read);
}
return ret;
or
private void Test()
{ ServicePointManager.ServerCertificateValidationCallback += new
RemoteCertificateValidationCallback(Certificate);
}
private static bool Certificate(object sender, X509Certificate certificate,
X509Chain chain, SslPolicyErrors policyErrors) {
return true;
}
check this link for more info http://blogs.msdn.com/b/dgorti/archive/2005/09/18/471003.aspx