Created
November 24, 2014 14:01
-
-
Save premchandpl/3e5d5c893b0ce35983ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static string GetHtmlSource(string siteUrl, ICredentials credentials, CookieContainer cc) | |
| { | |
| string resourceUrl = siteUrl; | |
| HttpWebRequest wreq = HttpWebRequest.Create(resourceUrl) as HttpWebRequest; | |
| wreq.Credentials = credentials; | |
| wreq.CookieContainer = cc; | |
| wreq.Method = "POST"; | |
| wreq.UserAgent = HtmlControlConstants.USERAGENT; | |
| wreq.ContentLength = 0; | |
| wreq.ContentType = HtmlControlConstants.CONTENTTYPE; | |
| string result; | |
| WebResponse wresp = wreq.GetResponse(); | |
| using (StreamReader sr = new StreamReader(wresp.GetResponseStream())) | |
| { | |
| result = sr.ReadToEnd(); | |
| } | |
| return result; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment