Solved

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

Posted on 2009-04-01
2
896 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
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…

679 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