ValidateCredentials() method fails for local user when machine is not connected to internet

Madhavi Thakare 1 Reputation point
2021-10-28T07:57:23.34+00:00

Hi,

I am using ValidateCredentials() method to validate a local user. However, I get an exception “Network name was not found” when the machine is not part of any domain and is not connected to the internet.

This is how I do it –

using (PrincipalContext pc = new PrincipalContext(ContextType.Machine, null))

bool isValid = pc.ValidateCredentials(username, password);

As per my understanding when the name parameter is null for a Machine context type, then the credentials are validated with the local computer SAM store.

Hence, I am trying to understand why this method fails to validate credentials of a local user when machine is not connected to any network. Is it mandatory to have internet access even if it validates against local store?

Windows for business | Windows Server | User experience | Other
0 comments No comments
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.