When i execute the code,its entering into the highlighted code,but not redirecting to home page.
using System.DirectoryServices.AccountManagement;
// set up domain context
using (PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "par"))
{
// validate the user's credentials
if (ctx.ValidateCredentials(userName, password)
{
// credentials are OK --> allow user in
}
else
{
// credentials aren't OK --> send back error message
}
}
When i debugged the code,its showing ValidateCredentials
doesnot exist in the current context.
Could some one please help me to figure out the issue.
Member
12 Points
140 Posts
LDAP Authentication not successful
Nov 02, 2020 01:00 AM|teenajohn1989|LINK
Hi,
After exploring in internet , LDAP can be integrated in ASP.NET Core razor pages using System.DirectoryServices.AccountManagement package.
I followed the method they are using in this post.
https://stackoverflow.com/questions/61167589/error-in-logging-in-authentication-against-active-directory-with-asp-net-core-by
When i execute the code,its entering into the highlighted code,but not redirecting to home page.
using System.DirectoryServices.AccountManagement; // set up domain context using (PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "par")) { // validate the user's credentials if (ctx.ValidateCredentials(userName, password) { // credentials are OK --> allow user in } else { // credentials aren't OK --> send back error message } }
When i debugged the code,its showing ValidateCredentials doesnot exist in the current context.
Could some one please help me to figure out the issue.