Jared.TW is Jared’s personal wiki consisting of thoughts ,notes and ideas about algorithms and programming. Jared work for a research institute in Taiwan now.
Tags:C#,Network Programming
Use the WebClient Class
/* */ /* Use the WebClient Class */ /* */ /* Copyright (C) 2006 Jared Liang. All Rights Reserved. */ /* Email: Jared@Jared.TW */ /* URL: http://Jared.TW */ /* */ private void loadhtml() { WebClient wc = new WebClient(); const string strUrl = "http://www.google.com/"; byte[] reqHTML; reqHTML = wc.DownloadData(strUrl); UTF8Encoding objUTF8 = new UTF8Encoding(); Console.WriteLine(objUTF8.GetString(reqHTML)); }
— Jared@Jared.TW 梁哲瑋 2007/03/19
Tags:C#,Network Programming
Post the Youtube Login Form with Webbrowser
/* */ /* Save Webbrowser Documents */ /* */ /* Copyright (C) 2007 Jared Liang. All Rights Reserved. */ /* Email: Jared@Jared.TW */ /* URL: http://Jared.TW */ /* */ private void mypost() { string Text1 = "username=username"; string Text2 = "password=password"; string Text3 = "current_form=loginForm"; string Text4 = "next=/index"; string Text5 = "action_login=Log+In"; UTF8Encoding encoder = new UTF8Encoding(); webBrowser1.Navigate(@"http://www.youtube.com/login", null, encoder.GetBytes(Text1 + "&" + Text2 + "&" + Text3 + "&" + Text4 + "&" + Text5), "Content-Type: application/x-www-form-urlencoded\r\n"); }
— Jared@Jared.TW 梁哲瑋 2007/03/16