草庐IT

directoryservices

全部标签

c# - UserPrincipal.FindByIdentity 权限

我正在尝试使用.NETSystem.DirectoryServices.AccountManagement库来获取特定ActiveDirectory用户的UserPrincipal。我有以下代码:PrincipalContextcontext=newPrincipalContext(ContextType.Domain,"DomainName");userPrincipal=UserPrincipal.FindByIdentity(context,IdentityType.SamAccountName,username);此代码以有效的域用户身份运行,但是当我执行它时出现以下异常:Sy

c# - 如何获取 guest /管理员的本地组名?

问题:我使用找到的代码http://support.microsoft.com/kb/306273添加一个windows用户。问题是我需要将用户添加到组中,但组名已本地化。例如MS-example使用英文计算机,这意味着您可以像这样获得guest组:grp=AD.Children.Find("Guests","group")但在非英语计算机上,“Guest”组名是本地化的,例如在我的德语操作系统上,Guests的组名是“Gäste”。这意味着要在我的计算机上运行支持示例,我需要将该行更改为grp=AD.Children.Find("Gäste","group")然后就可以了。现在如果操

c# - 命名空间中不存在类型或命名空间名称 'DirectoryServices'?

CS0234:Thetypeornamespacename'DirectoryServices'doesnotexistinthenamespace'System'(areyoumissinganassemblyreference?)此页面运行良好,显示直接来自服务的记录没有错误。但现在它给出了上述错误。/Columns>项目构建成功,但是当我打开页面时出现错误 最佳答案 添加目录服务引用后,右键单击reference并转到properties。将"CopyLocal"设置为true。

c# - DirectoryEntry IIS 访问权限

我有一个控制台应用程序,它列出了IIS中的网站绑定(bind)using(vardirectoryEntry=newDirectoryEntry("IIS://localhost/w3svc/"+GetWebSiteId())){varbindings=directoryEntry.Properties["ServerBindings"];}我通过进程从ASP.NET调用这个控制台应用程序varprocess=newProcess{StartInfo=newProcessStartInfo{FileName="c:/app.exe",Arguments="check",UseShell

c# - 使用 Windows 帐户授权

在我的Windows应用商店应用程序(c#)中,我有自己的授权机制:用户输入他们的账户名/密码并将其发送到服务器。服务器生成唯一token并将其返回给用户。对于所有下一个请求,用户都使用此token。现在我正在尝试仅使用Windows帐户进行授权。MSDNprovideUserInformation类,我可以获得用户帐户名称或用户域名。但我觉得这对我的授权方案来说还不够。还有方法GetSessionInitiationProtocolUriAsync看起来很有趣,但我不知道如何正确使用这样的Uri进行授权。如何在我的应用程序中使用Windows帐户进行授权?注意:我对两种情况都感兴趣:

c# - 事件目录服务 : PrincipalContext -- What is the DN of a "container" object?

我目前正在尝试使用PrincipalContext类通过ActiveDirectory服务进行身份验证。我想让我的应用程序使用密封和SSL上下文对域进行身份验证。为此,我必须使用thefollowingconstructorofPrincipalContext(linktoMSDNpage):publicPrincipalContext(ContextTypecontextType,stringname,stringcontainer,ContextOptionsoptions)具体来说,我是这样使用构造函数的:PrincipalContextdomainContext=newPrin

c# - 事件目录服务 : PrincipalContext -- What is the DN of a "container" object?

我目前正在尝试使用PrincipalContext类通过ActiveDirectory服务进行身份验证。我想让我的应用程序使用密封和SSL上下文对域进行身份验证。为此,我必须使用thefollowingconstructorofPrincipalContext(linktoMSDNpage):publicPrincipalContext(ContextTypecontextType,stringname,stringcontainer,ContextOptionsoptions)具体来说,我是这样使用构造函数的:PrincipalContextdomainContext=newPrin

c# - 我如何遍历 PropertyCollection

谁能提供一个示例来说明如何遍历System.DirectoryServices.PropertyCollection并输出属性名称和值?我正在使用C#。@JaredPar-PropertyCollection没有名称/值属性。它确实有一个PropertyNames和Values,类型为System.Collection.ICollection。我不知道构成PropertyCollection对象的basline对象类型。再次@JaredPar-我最初用错误的类型错误地标记了问题。那是我的错。更新:基于Zhaph-BenDuguid的输入,我能够开发以下代码。usingSystem.Co

c# - 我如何遍历 PropertyCollection

谁能提供一个示例来说明如何遍历System.DirectoryServices.PropertyCollection并输出属性名称和值?我正在使用C#。@JaredPar-PropertyCollection没有名称/值属性。它确实有一个PropertyNames和Values,类型为System.Collection.ICollection。我不知道构成PropertyCollection对象的basline对象类型。再次@JaredPar-我最初用错误的类型错误地标记了问题。那是我的错。更新:基于Zhaph-BenDuguid的输入,我能够开发以下代码。usingSystem.Co

c# - 创建使用 .NET 4.0 的应用程序池

我使用以下代码创建应用程序池:varmetabasePath=string.Format(@"IIS://{0}/W3SVC/AppPools",serverName);DirectoryEntrynewpool;DirectoryEntryapppools=newDirectoryEntry(metabasePath);newpool=apppools.Children.Add(appPoolName,"IIsApplicationPool");newpool.CommitChanges();如何指定应用程序池应使用.NETFramework4.0? 最佳