Solved

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

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

This article describes some very basic things about SQL Server filegroups.
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…

919 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now