private void Login2(string UserGuid, string LoginID, Boolean IsSuperAdmin) { //在登录的时候,是否检查此用户是否已登录,如已登录,则提醒。如果=1,这检查,否则不检查 String ISSingleLogin = ApplicationOperate.GetConfigValueByName("ISSingleLogin"); string strAlertInfo = ""; if (ISSingleLogin == "1") { Epoint.Frame.Bizlogic.UserManage.Detail_Frame_OnlineUser d_OnlineUser = new Epoint.Frame.Bizlogic.UserManage.DB_Frame_OnlineUser().GetDetail(UserGuid); if (d_OnlineUser.DisplayName != null && d_OnlineUser.DisplayName != "" && d_OnlineUser.IsOnline == 1) { strAlertInfo = "请注意:此账号已经在IP地址为:" + d_OnlineUser.LoginIP + "的机器上登录,并正在使用中!"; } } #region 2009.03.05 增加 判断当前是启用IP和用户对应关系,如果启用,判断当前用户的IP是否设置,如果设置,检查当前用户使用的IP是否和配置相同,如果不同,则提示 //通过参数LoginCheckingIP=1来检查是否启用此判断 if (ApplicationOperate.GetConfigValueByName("LoginCheckingIP") == "1") { String UserAllowIP = new DB_Frame_User_ExtendInfo().GetDetail(UserGuid).LoginIP; if (UserAllowIP != "") { UserAllowIP = ";" + UserAllowIP + ";"; if (UserAllowIP.IndexOf(";" + common.GetClientIp() + ";") == -1) { AlertAjaxMessage("您当前使用的IP不在系统配置中,不允许登录,请联系系统管理员!"); return; } } } #endregion #region FormsAuthentication.SetAuthCookie(HttpUtility.UrlEncode(LoginID), false); //保存登录名到HttpCookie HttpCookie cookie1 = new HttpCookie("EpointNetoffice7_LoginID"); cookie1.Value = HttpUtility.UrlEncode(LoginID); DateTime dtNow = DateTime.Now; TimeSpan tsMinute = new TimeSpan(1000, 0, 0, 0); cookie1.Expires = dtNow + tsMinute; Response.AppendCookie(cookie1); BasePage.mySessionRefresh += new RefreshSessionHandler(RefreshSession); string TargetPage = ""; //Add By XGC 添加是否有兼职的判断 Session["UserGuid"] = UserGuid; AddLoginInfo(1); //if (new User().IsExists_SecondOU(UserGuid)) //{ // string OUGuid = new DB_Frame_UserConfig().GetConfigValue_String(UserGuid, "IsDefaultOU"); // if (OUGuid != "") // SessionOperate.RefreshSessionFromUserGuid(UserGuid, OUGuid, IsSuperAdmin); // else // { // this.WriteAjaxMessage("ShowSecondOU('" + getTargetUrl(strAlertInfo, true) + "');"); // return; // } //} //else common.RefreshSessionFromUserGuid(UserGuid, IsSuperAdmin); TargetPage = getTargetUrl(strAlertInfo, false); if (TargetPage != "") Response.Redirect(TargetPage); //定义引用 #endregion }
private void Login2(string UserGuid, string LoginID, Boolean IsSuperAdmin) { //在登录的时候,是否检查此用户是否已登录,如已登录,则提醒。如果=1,这检查,否则不检查 String ISSingleLogin = ApplicationOperate.GetConfigValueByName("ISSingleLogin"); string strAlertInfo = ""; if (ISSingleLogin == "1") { Epoint.Frame.Bizlogic.UserManage.Detail_Frame_OnlineUser d_OnlineUser = new Epoint.Frame.Bizlogic.UserManage.DB_Frame_OnlineUser().GetDetail(UserGuid); if (d_OnlineUser.DisplayName != null && d_OnlineUser.DisplayName != "" && d_OnlineUser.IsOnline == 1) { strAlertInfo = "请注意:此账号已经在IP地址为:" + d_OnlineUser.LoginIP + "的机器上登录,并正在使用中!"; } } #region 2009.03.05 增加 判断当前是启用IP和用户对应关系,如果启用,判断当前用户的IP是否设置,如果设置,检查当前用户使用的IP是否和配置相同,如果不同,则提示 //通过参数LoginCheckingIP=1来检查是否启用此判断 if (ApplicationOperate.GetConfigValueByName("LoginCheckingIP") == "1") { String UserAllowIP = new DB_Frame_User_ExtendInfo().GetDetail(UserGuid).LoginIP; if (UserAllowIP != "") { UserAllowIP = ";" + UserAllowIP + ";"; if (UserAllowIP.IndexOf(";" + common.GetClientIp() + ";") == -1) { AlertAjaxMessage("您当前使用的IP不在系统配置中,不允许登录,请联系系统管理员!"); return; } } } #endregion #region FormsAuthentication.SetAuthCookie(HttpUtility.UrlEncode(LoginID), false); //保存登录名到HttpCookie HttpCookie cookie1 = new HttpCookie("EpointNetoffice7_LoginID"); cookie1.Value = HttpUtility.UrlEncode(LoginID); DateTime dtNow = DateTime.Now; TimeSpan tsMinute = new TimeSpan(1000, 0, 0, 0); cookie1.Expires = dtNow + tsMinute; Response.AppendCookie(cookie1); BasePage.mySessionRefresh += new RefreshSessionHandler(RefreshSession); string TargetPage = ""; //Add By XGC 添加是否有兼职的判断 Session["UserGuid"] = UserGuid; AddLoginInfo(1); //if (new User().IsExists_SecondOU(UserGuid)) //{ // string OUGuid = new DB_Frame_UserConfig().GetConfigValue_String(UserGuid, "IsDefaultOU"); // if (OUGuid != "") // SessionOperate.RefreshSessionFromUserGuid(UserGuid, OUGuid, IsSuperAdmin); // else // { // this.WriteAjaxMessage("ShowSecondOU('" + getTargetUrl(strAlertInfo, true) + "');"); // return; // } //} //else common.RefreshSessionFromUserGuid(UserGuid, IsSuperAdmin); TargetPage = getTargetUrl(strAlertInfo, false); if (TargetPage != "") { Response.Redirect(TargetPage); } //定义引用 #endregion }