这段代码可以使活动目录崩溃吗? [英] Can this code make active directory crash?

查看:67
本文介绍了这段代码可以使活动目录崩溃吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用此代码加载程序中的用户名。

但是我们遇到了这个问题。

我们强烈认为这会导致AD崩溃,Windows浏览器停止工作。



欢迎任何想法或建议。



We are using this code to load the username in the program.
But we encountered an issue with this.
We have a strong feeling that this leads to the AD crashes and the windows explorer who stops working.

Any idea''s or suggestions are welcome.

public void GetUserName()
        {
            UserName = Convert.ToString(System.DirectoryServices.AccountManagement.UserPrincipal.Current.DistinguishedName);
            int CurrentValueLeft = 2;
            string CurrentValue = "a";
            string UserNameLeft = UserName;
            UserName = "";

            while (CurrentValue != ",")
            {
                CurrentValueLeft = CurrentValueLeft + 1;
                CurrentValue = UserNameLeft.Substring(CurrentValueLeft, 1);
                if (CurrentValue != ",")
                {
                    UserName = UserName + CurrentValue;
                }

            }

推荐答案

不,它不会导致AD崩溃。



如果由于此代码导致AD在您的域控制器上崩溃,那么您的AD服务器会出现严重问题,而不是此代码。





BTW,DistinguishedName已经返回一个字符串。你不需要 Convert.ToString()调用。
No, it can''t make AD crash.

If AD is crashing on your domain controllers because of this code, then you''ve got major problems with your AD servers, not with this code.


BTW, DistinguishedName already returns a string. You don''t need the Convert.ToString() call.


这篇关于这段代码可以使活动目录崩溃吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆