/// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected virtual ILogOnUserInfo GetLogOnUserInfoObject()
        {
            //			if (Session["logonUserInfo"] == null)
            //			{
            //				if (Context.User.Identity.Name.Length == 0)
            //				{
            //					Session["logonUserInfo"] = GlobalInfo.UserLogOnInfo;
            //					string strMsg = "对不起,系统没有获取到您的登录信息数据!请重新登录系统!";
            //					HG.HGSupport.Common.CtrlException.TrueThrow(Session["logonUserInfo"] == null, strMsg);
            //				}
            //				else
            //					Session["logonUserInfo"] = new LogOnUserInfo(HttpContext.Current);
            //			}
            //
            //			return (ILogOnUserInfo)Session["logonUserInfo"];

            ILogOnUserInfo ilou = null;

            if (Context.User.Identity.Name.Length == 0)
            {
                ilou = GlobalInfo.UserLogOnInfo;
                string strMsg = "对不起,系统没有获取到您的登录信息数据!请重新登录系统!";
                ExceptionHelper.TrueThrow(ilou == null, strMsg);
            }
            else
            {
                ilou = new LogOnUserInfo(HttpContext.Current);
            }

            return(ilou);
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected virtual ILogOnUserInfo GetLogOnUserInfoObject()
        {
            //			if (Session["logonUserInfo"] == null)
            //			{
            //				if (Context.User.Identity.Name.Length == 0)
            //				{
            //					Session["logonUserInfo"] = GlobalInfo.UserLogOnInfo;
            ////					if (Session["logonUserInfo"] == null)
            ////					{
            ////						if (Response.Cookies[FormsAuthentication.FormsCookieName] != null)
            ////						{
            ////							FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(Response.Cookies[FormsAuthentication.FormsCookieName].Value);
            ////							HttpContext context = HttpContext.Current;
            ////
            ////							IIdentity id = new GenericIdentity(ticket.Name);
            ////							string[] strRoles = {""};
            ////							context.User = new GenericPrincipal(id, strRoles);
            ////
            ////							Session["logonUserInfo"] = new LogOnUserInfo(HttpContext.Current);
            ////						}
            ////					}
            //					string strMsg = "对不起,系统没有获取到您的登录信息数据!请重新登录系统!";
            //					HG.HGSupport.Common.CtrlException.TrueThrow(Session["logonUserInfo"] == null, strMsg);
            //				}
            //				else
            //					Session["logonUserInfo"] = new LogOnUserInfo(HttpContext.Current);
            //			}
            //
            //			return (ILogOnUserInfo)Session["logonUserInfo"];
            ILogOnUserInfo ilou = null;

            if (Context.User.Identity.Name.Length == 0)
            {
                ilou = GlobalInfo.UserLogOnInfo;
                string strMsg = "对不起,系统没有获取到您的登录信息数据!请重新登录系统!";
                ExceptionHelper.TrueThrow(ilou == null, strMsg);
            }
            else
            {
                ilou = new LogOnUserInfo(HttpContext.Current);
            }

            return(ilou);
        }
Beispiel #3
0
        protected void btnLogOn_Click(object sender, System.EventArgs e)
        {
            //			userName.Value = "luzhiqiang";
            //			userPassword.Value = "000000";
            try
            {
                ExceptionHelper.TrueThrow <ApplicationException>(string.IsNullOrEmpty(userName.Value), "对不起,登录名称不能为空");

                ILogOnUserInfo logonUserInfo = new LogOnUserInfo(userName.Value, userPwdType.SelectedItem.Value, userPassword.Value);

                Session["logonUserInfo"] = logonUserInfo;

                //记录系统登录日志(登录成功)
                SetUserPrincipal(logonUserInfo.UserLogOnName);

                FormsAuthentication.SetAuthCookie(logonUserInfo.UserLogOnName, false);

                GlobalInfo.InitHttpEnv(Request);
                GlobalInfo.InitLogOnUser(logonUserInfo);

                UserDataWrite.InsertUserLog(OGULogDefine.LOGON_APP,
                                            OGULogDefine.LOGON_TYPE_SUCCESS,
                                            "用户“" + logonUserInfo.OuUsers[0].UserDisplayName + "”成功登录!",
                                            logonUserInfo.UserLogOnName);

                SysDataWrite.InsertSysLog("jinshan", "y", "adfadsfasdfasdfasdf");

                string strRequestUrl = Request.QueryString["ReturnUrl"];

                if (strRequestUrl != null)
                {
                    FormsAuthentication.RedirectFromLoginPage(logonUserInfo.UserLogOnName, false);
                }
                else
                {
                    Response.Redirect("OGUAdmin.aspx", false);
                }
            }
            catch (System.Exception ex)
            {
                errorMsg.Visible = true;
                errorMsg.Text    = ex.Message.Replace("\n", "<br>");
            }
        }