日期:2014-05-17 浏览次数:20841 次
string url = "http://xxxx/Login.aspx";
//第一步
CookieCollection cookie = new CookieCollection();
HttpWebResponse HttpWResp = HttpWebResponseUtility.CreateGetHttpResponse(url, cookie, null, null);
cookie = HttpWResp.Cookies;
//第二步
Dictionary<string, string> para = new Dictionary<string, string>();
para.Add("UserID", "xxxx");
para.Add("UserPwd", "xxxx");
HttpWebResponse HttpWResp2 = HttpWebResponseUtility.CreatePostHttpResponse(url, para, cookie);
HttpWResp2.Dispose();
///第三步
url = "http://xxxx/List.aspx";
HttpWebResponse HttpWResp3 = HttpWebResponseUtility.CreateGetHttpResponse(url, cookie, null, null);
richTextBox1.Text = HttpWebResponseUtility.GetData(HttpWResp3);
HttpWResp3.Dispose();