i’m trying to login to Flash Site using ASP.NET C# httprequest…. i use Firebug and debug login address and found: http://sechiakhoanhkhac.com/live/data.php?mod=member&act=login
and my code here:
string UrlDangNhap = "http://sechiakhoanhkhac.com/live/data.php?mod=member&act=login";
//password=123456&email=dmsang -- password=123456&email=sangdeptrai
string username="sangdeptrai";
string strPostDataDangNhap = String.Format("password=123456&email={0}",username);
//Create Cookie to keep Login status
CookieContainer cookies = new CookieContainer();
HttpWebRequest wrDangNhap = WebRequest.Create(UrlDangNhap) as
HttpWebRequest;
wrDangNhap.Method = "POST";
wrDangNhap.ContentLength = strPostDataDangNhap.Length;
wrDangNhap.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
wrDangNhap.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1";
wrDangNhap.ContentType = "application/x-www-form-urlencoded";
wrDangNhap.KeepAlive = true;
wrDangNhap.CookieContainer = cookies;
StreamWriter swDangNhap = new StreamWriter(wrDangNhap.GetRequestStream());
swDangNhap.Write(strPostDataDangNhap);
swDangNhap.Close();
// do somethings after login
that code is wrong or right? because i cant login and dont know when i login-ed or not… because this is flash site so we can get response to check…
The web service needs the “Referer” field to be set, eg:
The service will then return the following response in the message body (which appears to be the username and ID):
Additional info: I used fiddler to inspect the request and response while logging in. The full request looks like this:
The decompressed response looks like this: