Solved

How do I use .NET ValidateCredentials when disconnected from a network

Posted on 2009-04-01
2
890 Views
Last Modified: 2013-12-17
Hi.

In a Windows Forms, .NET 3.5 application, I am validating user (login) authentication using a domain account with cached credentials, disconnected from *my* domain network.  If I am connected to *any* network, even a rogue wireless network the ValidateCredentials() works correctly.  However, when I disconnect from the network, I get this PrincipalOperationException exception:

"The network location cannot be reached. For information about network troubleshooting, see Windows Help. (Exception from HRESULT: 0x800704CF.

Is there a way to ValidateCredentials() without being connected to a network?
using (PrincipalContext context = new PrincipalContext(ContextType.Machine))
{
     valid = context.ValidateCredentials(txtUserName.Text, txtPassWord.Text);
}

Open in new window

0
Comment
Question by:SRO_TSG
2 Comments
 
LVL 9

Accepted Solution

by:
ripahoratiu earned 500 total points
ID: 24137252
Well, if you take a look to Active Directory you'll see that it's emptied, basically AD object are never stored locally.
"Active Directory is a directory service used to store information about the network resources across a domain and also centralize the network. Physically the Active Directory information is held on one or more equal peer domain controllers (DCs), replacing the NT PDC/BDC model."
Therefore you cannot use AD related methods without a network.

A better approach would be WindowsIdentity
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question