设置CustomValidator时出现以下错误:
无法加载文件或程序集“Ringo.Authentication”或其依赖项之一。系统找不到指定的文件。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IdentityModel.Selectors;
using System.IdentityModel.Tokens;
using Ringo.Utilities;
namespace Ringo.Authentication
{
public class CustomUserNameValidator : UserNamePasswordValidator
{
public override void Validate(string Username, string Password)
{
Accounts account = new Accounts();
if (account.CheckUserAccount(Username, Password))
{
return;
}
throw new SecurityTokenException("Accout is Invalid");
}
}
}
<serviceCredentials >
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Ringo.Authentication.CustomUserNameValidator, Ringo.Authentication"/>
</serviceCredentials>
任何帮助都会非常感谢!
答案 0 :(得分:0)
以下:
<serviceCredentials >
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Ringo.Authentication.CustomUserNameValidator, **Ringo.Authentication**"/>
</serviceCredentials>
应该是:
<serviceCredentials >
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Ringo.Authentication.CustomUserNameValidator, **Ringo**"/>
</serviceCredentials>