views:

10

answers:

0

I am using wsHttpBinding with custom username authentication. Thus, I had override Validate(string userName, string password) function of the UserNamePasswordValidator class. My Validate(...) like this:

public override void Validate(string userName, string password)
    {
        if (userName.Equals(string.Empty) || password.Equals(string.Empty))
            throw new ArgumentNullException("Username/Password cant be empty.");
        else
        {
            DBDataContext dc = new DBDataContext();
            if (dc.Users.Any(p => (p.Username.Equals(userName) && p.Password.Equals(password) ) ))
            {
                this.CUR_USER = dc.Users.FirstOrDefault(p => (p.Username.Equals(userName) && p.Password.Equals(password)));
                return;
            }                
            throw new SecurityTokenException("Wrong username or password");
        }
    }

My question is why this.CUR_USER still null after login? And how to debug the Validate(...) function at server side? Thanks in advanced.

P/S: sorry, my English is not very good.