无需密码即可验证MembershipUser?

时间:2011-12-07 23:13:15

标签: c# asp.net-membership forms-authentication formsauthenticationticket

是否可以在没有密码的情况下验证MembershipUser。我有用户帐户和临时密码,但我不要求这些用户实际登录。我想在他们的用户ID上自动验证它们。

可以这样做吗?

FormsAuthentication.SetAuthCookie(publicuser.UserName, false); 

似乎并没有真正认证他们再次成为memebrship提供者。

1 个答案:

答案 0 :(得分:1)

您可以覆盖System.ServiceModel.DomainServices.Server.ApplicationServices中定义的ValidateUser:

protected override bool ValidateUser(string userName, string password)

然后你可以检查

if ( IsAGuestAccount( userName ) ) return true;