Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2009-04-01
2
Medium Priority
?
925 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Creating a Cordova application which allow user to save to/load from his Dropbox account the application database.
How much do you know about the future of data centers? If you're like 50% of organizations, then it's probably not enough. Read on to get up to speed on this emerging field.
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

972 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