In .NET 4.7.2 I can get the current computer domain
using System.DirectoryServices.ActiveDirectory;
using (var lDomain = Domain.GetComputerDomain())
{
[...]
}
How can I get the current computer´s domain via asp.net core?
According to your description, I suggest you could try to use IPGlobalProperties to get your current domain.
It provides information about the.network connectivity of the local computer.
var re = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName;
Result:
Based on some searches, you should be able to install https://www.nuget.org/packages/System.DirectoryServices and use that class.
In .NET Core these classes are not part of the framework, requiring you to install Nuget packages for them.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.