asp.net这段代码是什么意思,账号密码是什么啊,需要用数据库吗,如果需要数据表怎么建
protectedvoidbtnLogin_Click(objectsender,EventArgse){//判断验证码是否输入正确stringcode=txtCode....
protected void btnLogin_Click(object sender, EventArgs e)
{
// 判断验证码是否输入正确
string code = txtCode.Text.Trim().ToUpper();
string rightCode = Session["Code"].ToString();
if (code != rightCode)
{
Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('验证码输入错误!');</script>");
return;
}
string name = txtName.Text.Trim();
string pwd = txtPassword.Text.Trim();
// 把密码转为MD5码的形式
pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(pwd, "MD5");
bool b = LoginManager.Login(name, pwd);
if (b)
{
// 登陆成功
Session["admin"] = name;
Response.Redirect("categorymanager.aspx");
}
else {
Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('登陆失败,用户名或者密码错误!');</script>");
}
} 展开
{
// 判断验证码是否输入正确
string code = txtCode.Text.Trim().ToUpper();
string rightCode = Session["Code"].ToString();
if (code != rightCode)
{
Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('验证码输入错误!');</script>");
return;
}
string name = txtName.Text.Trim();
string pwd = txtPassword.Text.Trim();
// 把密码转为MD5码的形式
pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(pwd, "MD5");
bool b = LoginManager.Login(name, pwd);
if (b)
{
// 登陆成功
Session["admin"] = name;
Response.Redirect("categorymanager.aspx");
}
else {
Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('登陆失败,用户名或者密码错误!');</script>");
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询