Solved

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

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Read about achieving the basic levels of HRIS security in the workplace.
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
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…

760 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

20 Experts available now in Live!

Get 1:1 Help Now