/// <summary> /// Load bytes from URL. /// </summary> public static byte[] Load(string url, CookieContainer cookieContainer = null) { using (var client = new StiWebClientEx(cookieContainer)) { client.Credentials = CredentialCache.DefaultCredentials; return(client.DownloadData(url)); } }
/// <summary> /// Load RichText from URL. /// </summary> public static string LoadRichText(string url, CookieContainer cookieContainer = null) { StiWebClientEx cl = new StiWebClientEx(cookieContainer); if (!string.IsNullOrEmpty(BaseAddress)) { cl.BaseAddress = BaseAddress; } cl.Credentials = CredentialCache.DefaultCredentials; byte[] bytes = cl.DownloadData(url); cl.Dispose(); MemoryStream stream = new MemoryStream(bytes); StreamReader sr = new StreamReader(stream, System.Text.Encoding.Default); string st = sr.ReadToEnd(); sr.Close(); return(st); }