問題描述
我需要訪問 Active Directory 以獲取有關客戶所屬組的信息.我的項目是一個使用 C# 的 ASP.Net MVC 應用程序.我以前從未針對 Active Directory 進行過編程,因此需要一些關于最佳入門方法、用于訪問信息的安全模型的建議,并且可能會為我提供一些不錯的教程.
I need to access Active Directory to get information about groups that customers belong to. The project I have is an ASP.Net MVC application using C#. I've never programmed against Active Directory before, and need some advice on what the best way to get started is, what security model to use to access the information, and maybe point me to some good tutorials.
推薦答案
由于您使用的是 MVC,您可以訪問新的 System.DirectoryServices.AccountManagement .NET 3.5 中的命名空間.這些類應該優(yōu)先于 DirectoryServices 本身中的舊類,因為它們使用起來要簡單得多.有幾個問題在 3.5 中尚未解決(例如,查詢組時限制 1500 個成員),但我確信這些問題已在 .NET 4.0 中得到修復.對于大多數(shù)任務,新類都能很好地工作.
Since you're using MVC, you have access to the new System.DirectoryServices.AccountManagement namespace in .NET 3.5. These classes should be preferred over the older classes in DirectoryServices itself as they are much simpler to use. There are a couple of gotchas that haven't been solved in 3.5 (1500 member limit when querying groups, for instance), but I'm assured that these have been fixed in .NET 4.0. For most tasks, the new classes work very well.
這篇關于使用 C# 從 ASP.Net MVC 訪問 Active Directory的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!