我正在尝试通过实现
当我在我的类
“类型或命名空间Select的名称在命名空间
为什么会出现这种错误?
UserNamePasswordValidator
来提供用户身份验证。我已添加Microsoft.IdentityModel
和System.IdentityModel.Tokens.ValidatingIssuerNameRegistry
nuget包。当我在我的类
UserAuthentication
中实现UserNamePasswordValidator
时,出现错误,显示:“类型或命名空间Select的名称在命名空间
System.IdentityModel
中不存在(您是否缺少某些参考)。”为什么会出现这种错误?
public class UserAuthentication : System.IdentityModel.Selectors.UserNamePasswordValidator
{
public override void Validate(string userName, string password)
{
try
{
if (userName == "test" && password == "test123")
{
Console.WriteLine("Authentic User");
}
}
catch (Exception ex)
{
throw new FaultException("Unknown Username or Incorrect Password");
}
}
}