/ Published in: C#
Expand |
Embed | Plain Text
// Taken from C# 3.0 Cookbook public static string GetHtmlFromUri(string resource) { string html = string.Empty; HttpWebRequest req = (HttpWebRequest)WebRequest.Create(resource); using (HttpWebResponse resp = (HttpWebResponse)req.GetResponse()) { bool isSuccess = (int)resp.StatusCode < 299 && (int)resp.StatusCode >= 200; if (isSuccess) { { html = reader.ReadToEnd(); } } } return html; }
Comments
Subscribe to comments
You need to login to post a comment.

Amazing!