日期:2014-05-17 浏览次数:20463 次
<input id="Button1" type="Button" value="" runat="server" onserverclick="Login_click" style="background:url(images_login/dl.gif); border-style:none; width:49px; height:18px; background-repeat:no-repeat;" />
protected void Login_click(object sender, EventArgs e) { string user = Request.Form["textfield"].ToString(); string pwd = Request.Form["textfield2"].ToString(); UM.userName = user; if(UB.users_Query_by_Name_exist(UM)) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('用户不存在!');</script>"); } else { DataSet ds = UB.users_QueryUserDetail_by_Name(UM); string EnPwd = ds.Tables[0].Rows[0]["password"].ToString(); //解密前的密码 string DePwd = DESEncrypt.Decrypt(EnPwd); //解密后的密码 if(DePwd!=pwd) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('密码错误,请重试!');</script>"); } else { Session["user"] = user; Response.Redirect("Admin_Index.html"); } } }
<form id="form1" runat="server"> <div> <input id="btnLogin" type="Button" value="登录" runat="server" onserverclick="Login_click" /> </div> </form>