Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# WCF WPF .NET4 domain , +
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 17-Jun-13 0:45am
Edited 17-Jun-13 2:33am
Pheonyx at 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 at 17-Jun-13 7:00am
Its not throwing any error. It always returns false even though the Username/Password is correct.
richcb at 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 at 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 at 18-Jun-13 10:12am
Does pc.ValidateCredentials() return a bool?
Venkatesh Mookkan at 18-Jun-13 10:14am
Yes - Its false. That's what mentioned in the email.
richcb at 18-Jun-13 10:15am
Ok, so wouldn't the problem exist in that method instead of the method call?
Venkatesh Mookkan at 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
0 Maciej Los 495
1 Sergey Alexandrovich Kryukov 419
2 OriginalGriff 360
3 CHill60 310
4 CPallini 275
0 Sergey Alexandrovich Kryukov 10,017
1 OriginalGriff 9,495
2 Peter Leow 5,241
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 3,076

Advertise | Privacy | Mobile
Web03 | 2.8.150327.1 | Last Updated 17 Jun 2013
Copyright © CodeProject, 1999-2015
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