Last post Aug 27, 2019 09:37 AM by Yongqing Yu
Aug 26, 2019 08:02 PM|Baze72|LINK
How can I use the below code, without using a password, or is it OK to have this information in the controller? I have created a page to do some AD updates which work fine, just want to make sure this is the best way to do it?
PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "Domain.local", "User", "Password");
Aug 27, 2019 09:37 AM|Yongqing Yu|LINK
How can I use the below code, without using a password, or is it OK to have this information in the controller?
If you have used windows authentication in your web.config, you can use the PrincipalContext without password to get information.
You can refer to this link : Accessing Active Directory Records Via ASP.NET
Here is my result when using PrincipalContext :