Share via

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

Anonymous
2021-10-28T06:18:41+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.

So, 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 home | Other | Security and privacy

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2021-10-28T07:58:42+00:00

    Thanks! I'll post the question on the mentioned link.

    Was this answer helpful?

    0 comments No comments
  2. DaveM121 891.1K Reputation points Independent Advisor
    2021-10-28T07:45:09+00:00

    Hi Madhavi

    I am Dave, I will help you with this.

    I apologize, Community is just a consumer forum, due to the scope of your question (programming) can you please post this question to our sister forum on Microsoft Q&A (The Developer forum)

    Over there you will have access to a host of developers and will get a knowledgeable and quick answer to this question

    https://docs.microsoft.com/en-us/answers/index....

    Was this answer helpful?

    0 comments No comments