I am testing out the CustomUserNamePassword Validator for WCF and so far it only works if I validate the username test and the password test. If I use something else, such as test1 for the username and test1 for the password, it throws the FaultException. Here is the code the validator:
public override void Validate(string userName, string password)
{
if (userName != "test" || password != "test")
throw new FaultException("Username and Password Failed");
}
I am using a Console App to connect to an IIS Hosted Service and I am calling instantiating the credentials like this:
client.ClientCredentials.UserName.UserName = "test";
client.ClientCredentials.UserName.Password = "test";
The above works, but if I hard code the validator to something like test1 and test1 and then do:
client.ClientCredentials.UserName.UserName = "test1";
client.ClientCredentials.UserName.Password = "test1";
The above fails even if I have:
public override void Validate(string userName, string password)
{
if (userName != "test1" || password != "test1")
throw new FaultException("Username and Password Failed");
}
I am building the app.config and the ProxyCode with svcutil. Could that have anything to do with it? I did regenerate the code.
I figured out what the problem was. I have 3 solutions (A WCF Service Library, A WCF Website that uses the service library, and a Console App that had code generated from the WCF Service Website url wsdl). I was updating the WCF Service Library, and the Console app, but I was not updating the reference for the website. Once I did this, it all worked fine.
Thanks for the help.
[updated answer, I had misunderstood the question]
Is the server side being redeployed? You can try updating the application, or trying to attach a debugger to the server side to see if you have the correct code being run.