当前位置:编程学习 > C#/ASP.NET >>

请给一个asp.net完整的登陆校验代码和数据库连接的代码(c#)

C#的代码 需要一个页面的校验代码
1.数据库sql2005
2.登陆界面 name、password、确定
3.校验 成功就跳转到正确页面、错误就返回错误页面
答案:

protected void Button1_Click1(object sender, EventArgs e)
{
string temo = Session["Checkde"].ToString();
if (UserID.Text.Length < 1 || password.Text.Length < 1)
{
Alert.ShowPre("请正确输入您的用户名和密码.");
Response.End();
}
if (temo == code.Text.ToUpper())
{
UserBLL UB = new UserBLL();
CMS.Model.User Ue = UB.GetModel(UserID.Text.ToLower(), password.Text.ToLower());
if (Ue!=null)
{
Session["user"] = "admin";
Response.Redirect("../SortManage.aspx");
}
else
{
Alert.ShowLocation("用户名或密码不正确,请重新输入.");
}
}
else
{
Alert.ShowLocation("验证码错误,请重新输入.");
}
}
}

上一个:[asp.net]在javascrip代码块中怎样写一个按钮单击事件? 急!!!
下一个:高分求!!sql server配合asp.net或者asp做出来的题库的程序代码!!

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,