新版newshuadan升级专用
private Boolean login() {
getUserInfo();
string username = this.tbxloginid.Text.Trim();
string password = this.tbxpwd.Text.Trim();
if (list != null)
{
if (list[0] == "nologin")
{
return false;
}
else {
if (list[0] == username && list[1] == password)
{
return true;
}
else {
return false;
}
}
}
else {
return false;
}
}
private List<string> getUserInfo() {
try
{
string url = "http://blog.csdn.net/xiaokailele/article/details/48521517";
string content = getInfo.GetStrHtml(url, false);
if (content != null)
{
string[] str = getInfo.gettd(content, "//span[@class='link_title']")[0].InnerText.Split(';');
list.Add(str[0].Replace("\r\n","").Trim());
list.Add(str[1].Replace("\r\n", "").Trim());
}
}
catch (Exception ex) { }
return list;
}
然后winform程序调用
if (login())
{
Form1 frm1 = new Form1();
frm1.Show();
this.Visible = false;
}
else
{
MessageBox.Show("用户口令错误");
}