登陆按钮事件:
private void Btn_login_Click(object sender, System.EventArgs e)
{
string username = this.txt_name.Text.Trim();
string userpass = this.txt_pass.Text.Trim();
string filename = Server.MapPath(".//XMl/User.xml");
string str = OperateXmlByDataSet.UserLogin(filename,"username",username,"userpass",userpass);
Session["username"]=str;
if(str!="sorry")
{
this.Lab_flag.Text=str+"登陆成功!";
//登陆成功后的操作 }
else
{
this.Lab_flag.Text="请重新登陆";
}
}
文中用到OperateXmlByDataSet的UserLogin方法,代码如下:{
string username = this.txt_name.Text.Trim();
string userpass = this.txt_pass.Text.Trim();
string filename = Server.MapPath(".//XMl/User.xml");
string str = OperateXmlByDataSet.UserLogin(filename,"username",username,"userpass",userpass);
Session["username"]=str;
if(str!="sorry")
{
this.Lab_flag.Text=str+"登陆成功!";
//登陆成功后的操作 }
else
{
this.Lab_flag.Text="请重新登陆";
}
}
用户登陆