Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public bool Login(string username, string password)
- {
- byte[] bytes = Encoding.ASCII.GetBytes("cookieuser=1&do=login&vb_login_username=" + HttpUtility.UrlEncode(username) + "&vb_login_password=" + HttpUtility.UrlEncode(password));
- HttpWebRequest request = (HttpWebRequest)WebRequest.Create(this.LoginPage);
- request.CookieContainer = new CookieContainer(0x80);
- request.Timeout = Leech.GlobalTimeout;
- request.Method = "POST";
- request.ContentType = "application/x-www-form-urlencoded";
- request.ContentLength = bytes.Length;
- Stream requestStream = request.GetRequestStream();
- requestStream.Write(bytes, 0, bytes.Length);
- requestStream.Close();
- HttpWebResponse response = (HttpWebResponse)request.GetResponse();
- if (response != null)
- {
- StreamReader reader = new StreamReader(response.GetResponseStream());
- string contents = reader.ReadToEnd().Trim();
- reader.Close();
- File.WriteAllText("D.html", contents);
- foreach (Cookie cookie in response.Cookies)
- {
- if (cookie.Name.EndsWith("bbuserid") && (cookie.Value.Length > 0))
- {
- }
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement