0
我試圖使用ASP.NET C#HttpRequest的....我使用Firebug和調試登錄地址,發現登錄到Flash網站:http://sechiakhoanhkhac.com/live/data.php?mod=member&act=login登錄Flash網站使用的HttpRequest
和我的代碼在這裏:
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();
//做登錄
代碼是錯誤的或右後出頭?因爲我不能登錄,不知道我什麼時候登錄或不...因爲這是Flash網站,所以我們可以得到響應檢查...
咱們我試試........... –
它的工作:) –