Advertisement
Guest User

Untitled

a guest
Jun 9th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. public override bool Login(string username, string password)
  2. {
  3. HttpWebRequest templateRequest = base.GetTemplateRequest("https://secure.runescape.com/m=weblogin/login.ws");
  4. templateRequest.Method = "POST";
  5. templateRequest.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
  6. templateRequest.ContentType = "application/x-www-form-urlencoded";
  7. templateRequest.Headers.Add("Accept-Encoding", "en-GB,en-US;q=0.8,en;q=0.6");
  8. templateRequest.Headers.Add("Accept-Language", "gzip, deflate, br");
  9. templateRequest.Referer = this.mainUrl;
  10. templateRequest.CookieContainer = this.session;
  11. using (Stream requestStream = templateRequest.GetRequestStream())
  12. {
  13. string s = string.Format("username={0}&password={1}&mod=www&ssl=1&dest=account_settings.ws", username, password);
  14. byte[] bytes = Encoding.UTF8.GetBytes(s);
  15. requestStream.Write(bytes, 0, bytes.Length);
  16. }
  17. bool result;
  18. using (HttpWebResponse httpWebResponse = (HttpWebResponse)templateRequest.GetResponse())
  19. {
  20. using (StreamReader streamReader = new StreamReader(httpWebResponse.GetResponseStream()))
  21. {
  22. string text = streamReader.ReadToEnd();
  23. this.HasMembership = !text.Contains("Currently Not a Member");
  24. result = text.Contains("Sign Out");
  25. }
  26. }
  27. return result;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement