我是一名程序员学生,我需要制作一个Web应用程序以查看所有文件夹,子文件夹和文件以及可以访问它们的人...我还需要列出活动目录的组和用户并遍历所有目录服务器对其进行修改。 但是我是c#菜鸟,三周前我开始学习asp.net ... 我想知道是否有人可以通过解释所有MVC层之间的通信方式来帮助我。 我已经编写了一些函数,但是我不知道如何使它们交互... 谢谢你的帮助 ! (对不起,我英语不好,我是法语... ^^')
答案 0 :(得分:0)
对于新手来说,您要问的内容确实很复杂。 由于您正在启动并且正在使用asp.net,因此我建议您从 ASP.NET Core 重新开始,它是基于.Net Core的新Web框架。
那里有很多资源和课程。我建议您获得 Pluralsight订阅,其中有很多课程,它们的确很棒,几乎所有的老师都是MVP。对于Building ASP.NET Core Applications:,有一条道路(有点像职业者)。
我已经与.net核心中的活动目录组和用户进行过一些合作,但是您需要首先了解最基础的知识。
以下代码包含一些我用来验证具有活动目录的用户的方法,以及获取该目录内所有计算机的列表的方法,但是正如我所说,您需要先了解基础知识使该代码在您的应用程序内正常工作
public bool ValidateWithActiveDirectory(string domainUrl, string userName, string password) {
using (var context = new PrincipalContext(ContextType.Domain, domainUrl)) {
UserPrincipal UserPrincipal1 = new UserPrincipal(context);
PrincipalSearcher search = new PrincipalSearcher(UserPrincipal1);
foreach (UserPrincipal result in search.FindAll()) {
}
if (context.ValidateCredentials(userName, password)) {
return true;
}
}
return false;
}
public IEnumerable<Computer> GetActiveDirectoryComputers(string domainUrl) {
IList<Computer> computers = new List<Computer>();
PrincipalContext context = new PrincipalContext(ContextType.Domain, domainUrl);
ComputerPrincipal computerPrincipal = new ComputerPrincipal(context);
PrincipalSearcher search = new PrincipalSearcher(computerPrincipal);
foreach (ComputerPrincipal result in search.FindAll()) {
computers.Add(new Computer(result.Name));
}
return computers;
}
注意::如果您加入Visual Studio Dev Essentials,他们将为您提供1个月的免费复数订阅。