Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Working with DirectoryServices in ASP.NET Core

Tags:

I am upgrading my ASP.NET Core RC1 application to RC2. I have some references to System.DirectoryServices and System.DirectoryServices.AccountManagement in some *.cs files so that I can query LDAP. But I have no idea how to add references to it in RC2 in the Project.json file. Everything that I try just gives me more errors. Any help is appreciated.

{   "version": "1.0.0-*",   "buildOptions": {     "emitEntryPoint": true,     "preserveCompilationContext": true   },    "dependencies": {     "Microsoft.NETCore.App": {       "version": "1.0.0-rc2-3002702",       "type": "default"     },     "Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",     "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",     "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",     "Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0-rc2-final",     "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",     "Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",     "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview1-final",     "Microsoft.EntityFrameworkCore": "1.0.0-rc2-final",     "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final",     "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview1-final",     "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.0.0-rc2-final",     "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0-rc2-final",     "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",     "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",     "Newtonsoft.Json": "8.0.3",     "Microsoft.Extensions.Logging": "1.0.0-rc2-final",     "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",     "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",     "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc2-final",     "System.Linq": "4.0.1-beta-23516",     "System.Linq.Queryable": "4.0.1-beta-23516"   },    "tools": {     "Microsoft.AspNetCore.Razor.Tools": {       "version": "1.0.0-preview1-final",       "imports": "portable-net45+win8+dnxcore50"     },     "Microsoft.AspNetCore.Server.IISIntegration.Tools": {       "version": "1.0.0-preview1-final",       "imports": "portable-net45+win8+dnxcore50"     },     "Microsoft.EntityFrameworkCore.Tools": {       "version": "1.0.0-preview1-final",       "imports": [         "portable-net45+win8+dnxcore50",         "portable-net45+win8"       ]     },     "Microsoft.Extensions.SecretManager.Tools": {       "version": "1.0.0-preview1-final",       "imports": "portable-net45+win8+dnxcore50"     },     "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {       "version": "1.0.0-preview1-final",       "imports": [         "portable-net45+win8+dnxcore50",         "portable-net45+win8"       ]     }   },    "frameworks": {     "netcoreapp1.0": {       "imports": [         "dotnet5.6",         "dnxcore50",         "portable-net45+win8"       ]     }   },    "publishOptions": {     "include": [       "wwwroot",       "Views",       "appsettings.json",       "web.config"     ]   },    "scripts": {     "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]   } } 
like image 828
BinaryNexus Avatar asked May 19 '16 17:05

BinaryNexus


People also ask

What is System DirectoryServices AccountManagement?

System. DirectoryServices. AccountManagement namespace provides a set of APIs that can be used to access users, security groups and other directory objects stored in Active Directory, which I will demonstrate below. To get started you need to add a reference to System.

What is LDAP authentication in C#?

LDAP. We have an web application developed using c#(VS 2008/3.5 framework). The application uses the mode of authentication as "Windows" with a service account present in domain (Domain1) to run the application as ASP.Net user. We have authentication to be done for the users present in different domain (Domain 2).

What is DirectorySearcher in c# net?

FindAll Method (System. DirectoryServices) Executes the search and returns a collection of the entries that are found.


1 Answers

Just want to say that they just issued a pre-release of the Microsoft.Windows.Compatibility which contains the System.DirectoryServices components needed to work directory with active directory. its beta, but its finally out there.

  • NuGet Microsoft.Windows.Compatibility
like image 69
Bastyon Avatar answered Sep 20 '22 08:09

Bastyon