protected void lgiSystem_Authenticate(object sender, AuthenticateEventArgs e) { vUTPUserWithRole objUTPUser; string userName; //用户名 string passWord; //密码 string strRightCode; //角色代码 string userId; //用户ID Boolean LoginSuccess; string tempMD5; userName = lgiSystem.UserName; passWord = lgiSystem.Password; if (userName != string.Empty && passWord != string.Empty) { BLL_UTPUser = new UTPUser(); objUTPUser = BLL_UTPUser.GetUTPUserBLL(userName); userId = objUTPUser.UserID; //roleId = objUTPUser.RoleID;//"586487590170100231" strRightCode = "Schedule Billing (SD)";//"586487590170100231" tempMD5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(userId + passWord, "MD5"); LoginSuccess = BLL_UTPUser.UTPUserAuthenticate(userId, tempMD5, strRightCode); if (LoginSuccess) { e.Authenticated = true;//验证通过 Server.Transfer("~/Schedule Billing/ScheduleTasksForm.aspx"); } else { e.Authenticated = false; } } else { e.Authenticated = false; } }
/// <summary> /// UTP用户验证函数 /// </summary> public void UTPUserAuthenticate() { bool bln = true; //UTP登录用户ID string struid = string.Empty; //UTP中登录用户名+登录用户口令的MD5值,身份验证 string strcid = string.Empty; //指定启动SD下的模块ID,指定功能 string strmid = string.Empty; //测试变量 string strDebug = string.Empty; #region 获取页面传值 if (Request.QueryString["uid"] != null && Request.QueryString["uid"] != string.Empty) { struid = Request.QueryString["uid"].ToString(); } if (Request.QueryString["cid"] != null && Request.QueryString["cid"] != string.Empty) { strcid = Request.QueryString["cid"].ToString(); } if (Request.QueryString["mid"] != null && Request.QueryString["mid"] != string.Empty) { strmid = Request.QueryString["mid"].ToString(); } if (Request.QueryString["Debug"] != null && Request.QueryString["Debug"] != string.Empty) { strDebug = Request.QueryString["Debug"].ToString(); } #endregion //是否是测试状态 if (strDebug.Equals("true")) { return; } else if (struid != string.Empty && strcid != string.Empty && strmid != string.Empty) { UTPUser utpuser = new UTPUser(); //调用UTP用户验证函数 bln = utpuser.UTPUserAuthenticate(struid, strcid, strmid); if (bln) { //验证用户有效跳转到相应的页面 Response.Redirect("Schedule Billing/ScheduleTasksForm.aspx"); } else { Response.Redirect("NoPermissionForm.aspx"); } } else { //页面没有接到任何值跳转到错误提示页面 Response.Redirect("NoPermissionForm.aspx"); } }