1
我已經創建了一個繼承自MembershipProvider的BasicMembershipProvider類,實現時,ValidateUser不會被調用。這是我的設置:ASP.NET FormsAuthentication不使用默認的MembershipProvider
的web.config
<membership defaultProvider="BasicMembershipProvider">
<providers>
<clear/>
<add name="BasicMembershipProvider" type="MyMVCProject.Providers.BasicMembershipProvider"/>
</providers>
</membership>
BasicMembershipProvider.cs
public class BasicMembershipProvider : MembershipProvider
{
//THIS FUNCTION NEVER GETS CALLED
public override bool ValidateUser(string email, string password)
{
//Do custom checks.
}
}
控制器
FormsAuthentication.Authenticate(model.Email, model.Password)
是這個去了解我自己重寫的MembershipProvider方式會員邏輯?如果是這樣,爲什麼在我打電話給FormsAuthentication.Authenticate()
時爲什麼沒有調用過濾函數ValidateUser
?
+1確實。它不,這是絕對荒謬的。像其餘的FormsAuthentication一樣。 – Aliostad 2011-10-03 11:10:42
@Aliostad我在'FormsAuthentication'的部分笑話很荒謬。然後我記得它實際上很糟糕。而我卡住使用它:( – Yuck 2012-10-08 22:35:16