Beispiel #1
0
        private void InsertLoginLog()
        {
            objControllerLogin = new ControllerLogin();

            string userName = string.Empty;

            using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, Convert.ToString(Session["DomainName"])))
            {
                UserPrincipal user = new UserPrincipal(pc);
                user = UserPrincipal.FindByIdentity(pc, Convert.ToString(Session["UserName"]));
                if (user != null)
                {
                    userName = user.GivenName + " " + user.Surname;
                }
                else
                {
                    userName = Convert.ToString(Session["UserName"]);
                }
            }

            objControllerLogin.InsertLoginLog(Convert.ToString(Session["NTID"]), Convert.ToString(Session["DomainName"]), Convert.ToString(userName));
        }