Reputation: 93
Using c#, I run my code in one computer perfectly fine, and in another machine I got this error:
System.IO.FileNotFoundException: The network path was not found.
at System.DirectoryServices.AccountManagement.UnsafeNativeMethods.IADs.Get(String bstrName)
at System.DirectoryServices.AccountManagement.CredentialValidator.BindSam(String target, String userName, String password)
at System.DirectoryServices.AccountManagement.CredentialValidator.Validate(String userName, String password, ContextOptions connectionMethod)
at System.DirectoryServices.AccountManagement.PrincipalContext.ValidateCredentials(String userName, String password, ContextOptions options)
at CheckMemberStep(String& username, String password)
Code:
using (var context = new PrincipalContext(currentContextType))
{
step.IsReady = context.ValidateCredentials(user, password, ContextOptions.Negotiate);
}
I gave logon user necessary permissions such as log on as a service and access from a network. And still getting this machine specific error. May you give me any insights?
Machine is Win server 2016 64 bit .Net version 4.6.2 It is a WPF application. Context is set as ContextType.Machine. Logon user is the user running the app.
Upvotes: 0
Views: 205
Reputation: 906
After searching in the dark corners of the internet for your weird issue I've found that remote directory access was removed from Windows 7 and onwards if the user is not part of the local workgroup, check here. I am not 100% sure if this is your specific issue, but I am 60%. So maybe the issue is caused by the fact that the user is part of the local workgroup on those machines and it is working, whereas the user is not part of the local workgroup on this particular machine.
Upvotes: 0