protected override void OnInit(EventArgs e) { base.OnInit(e); SystemConfig = new CMS_Config(); CurrentAdmin = CMS_AdminUser.CurrentAdmin; //判断是否登录了 if (CurrentAdmin == null) { Response.Redirect("Login.aspx?t='exit'"); } //动态加入CSS文件 HtmlLink link = new HtmlLink(); link.Attributes.Add("href", "../Css/ManageCss/STYLE.CSS"); link.Attributes.Add("type", "text/css"); link.Attributes.Add("rel", "Stylesheet"); this.Page.Header.Controls.Add(link); //动态加入JS文件 ClientScript.RegisterClientScriptInclude("jquery", "../Scripts/jquery-1.2.6.min.js"); ClientScript.RegisterClientScriptInclude("jquery.validate", "../Scripts/jquery.validate.js"); }
protected void tbLogin_Click(object sender, EventArgs e) { BLL.CMS_AdminUser bau = new BLL.CMS_AdminUser(); string code = tbx_yzm.Text; HttpCookie htco = Request.Cookies["ImageV"]; string scode = htco.Value.ToString(); if (code != scode) { Response.Write("<script>alert('验证码输入不正确!')</script>"); } else { CMS_AdminUser admin = bau.GetModel(tbAdmName.Text); if (admin == null) { lbWarningName.Text = "用户不存在"; return; } else { lbWarningName.Text = ""; } if (admin.Pwd != FormsAuthentication.HashPasswordForStoringInConfigFile(tbAdmPwd.Text, "MD5")) { lbWarningPwd.Text = "密码错误"; return; } else { lbWarningPwd.Text = ""; } CMS_AdminUser.CurrentAdmin = admin; Response.Redirect("Index.aspx"); } }