现在的位置: 首页 > 综合 > 正文

域登录验证

2013年04月10日 ⁄ 综合 ⁄ 共 424字 ⁄ 字号 评论关闭
        public bool TryAuthenticate(string domain, string userName, string password)
        {
            bool isLogin = false;
            try
            {
                DirectoryEntry entry = new DirectoryEntry(string.Format("LDAP://{0}", domain), userName, password);
                entry.RefreshCache();
                isLogin = true;
            }
            catch
            {
                isLogin = false;
            }
            return isLogin;
        }

抱歉!评论已关闭.