Click here to Skip to main content
13,047,567 members (59,141 online)
Rate this:
Please Sign up or sign in to vote.

I am working on a Messaging Application built using WPF and WCF-RESTful site. I am don't have much experience in WCF

This application is used inside intranet as well as internet. The application prompts for authentication (custom login screen in the messaging application) when it accessed through internet (outside the domain).

We have written authentication logic in the WCF service like below,

using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, domain))
    if (!pc.ValidateCredentials(userName, password, ContextOptions.Negotiate))
        return string.Empty;

The Website's application pool is set to use NetworkService. The website's authentication is "Anonymous" as the Intranet User's do not require to authenticate.

I do not get any error or exception. Instead, it always returns "false" for any username even though the credential are correct.

Can you please tell me what I am missing here?

Thanks in Advance.
Posted 16-Jun-13 23:45pm
Updated 17-Jun-13 1:33am
Pheonyx 17-Jun-13 6:54am
Are you getting an error? Is something not working?
So far you've explained what you are doing but not what your issue is (at least not that I can see).
Venkatesh Mookkan 17-Jun-13 7:00am
Its not throwing any error. It always returns false even though the Username/Password is correct.
richcb 17-Jun-13 17:03pm
In your if statement, you are checking if pc.ValideCredentials() is NOT true. So if it is true, you will get false and therefore never get to the code inside.
Venkatesh Mookkan 17-Jun-13 22:09pm
Hi Richcb,
The Statement is correct. I have copied only on the code snippet which validates the user. If the Validation fails, it would return Empty string else it would process the further steps.
richcb 18-Jun-13 10:12am
Does pc.ValidateCredentials() return a bool?
Venkatesh Mookkan 18-Jun-13 10:14am
Yes - Its false. That's what mentioned in the email.
richcb 18-Jun-13 10:15am
Ok, so wouldn't the problem exist in that method instead of the method call?
Venkatesh Mookkan 18-Jun-13 22:21pm
The only functional piece in this method is the above statement. Rest of them are just validation and finalization.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 17 Jun 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100