Hello Everyone
My first post here!
I've been struggeling with facebook the whole evening. I'm unable to login with it. It just redirects me to the front site, not replying wrong password or anything.
Here's the code:
Anyone have an idea why?Code:string strUserName = "the%40email.com;// Properties.Settings.Default.facebookemail; string strPassword = "password";// Properties.Settings.Default.facebookpassword; // Get startpage and login string strPostData = String.Format("email={0}&pass={1}&login=Login", strUserName, strPassword); request = WebRequest.Create("https://login.facebook.com/login.php?m=&next=http%3A%2F%2Fm.facebook.com%2Fhome.php") as HttpWebRequest; request.Method = "POST"; request.ContentLength = strPostData.Length; request.ContentType = "application/x-www-form-urlencoded"; request.AllowAutoRedirect = true; request.CookieContainer = new CookieContainer(); request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3"; ASCIIEncoding encoding = new ASCIIEncoding(); byte[] loginDataBytes = encoding.GetBytes(strPostData); request.ContentLength = loginDataBytes.Length; Stream stream = request.GetRequestStream(); stream.Write(loginDataBytes, 0, loginDataBytes.Length); HttpWebResponse webResp = (HttpWebResponse)request.GetResponse(); Stream datastream = webResp.GetResponseStream(); StreamReader reader = new StreamReader(datastream); myFile = File.CreateText("C:\\t.txt"); myFile.Write(reader.ReadToEnd()); foreach (Cookie cook in webResp.Cookies) { MessageBox.Show(cook.Name+" "+cook.Value); } myFile.Close();
I've made som wireshark traces and it seems that after login is done it checks the session:
151 11.906270 192.168.1.8 69.63.176.67 HTTP GET /checkcookie.php?r8476606e=&next=http%3A%2F%2Fwww.f acebook.com%2F&refid=9&m_sess=581326628%3A10951669 85 HTTP/1.1
and the cookie sent is:
Cookie: datr=1232160427-4e8b9f0fd2e204bc689bf42bf9660d84400e8024a94ed3d965 381; made_write_conn=1232160427; cur_max_lag=20; m_user=the%40email.com%3A581326628%3AkCjgUPBi6ODv6 aLr\r\n
Thereafter a 301 to facebook.com then sv.facebook.com is received.
Any help would be appreciated!
Best regards,
Marcus



LinkBack URL
About LinkBacks




