0

我有一个自定义会员提供程序,我正在为我正在开发的网站使用,我有很多错误,他们都谈到了正在使用的方法。这是错误之一:

错误 # 'WebOrder.CustomMembershipProvider' 没有实现继承的抽象成员 'System.Web.Security.MembershipProvider.FindUsersByEmail(string, int, int, out int)' C:\Users\Jschoff\Documents\Visual Studio 2010\Projects\WebOrder \WebOrder\Models\CustomMembershipProvider.cs

我不知道究竟是什么原因造成的,但这里是我正在使用的 customprovider 类的代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WebOrder
{
  public class CustomMembershipProvider : System.Web.Security.MembershipProvider
  {
    public override System.Web.Security.MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out System.Web.Security.MembershipCreateStatus status)
    {
        throw new NotImplementedException();
    }

    public override System.Web.Security.MembershipUser GetUser(string username, bool userIsOnline)
    {
        throw new NotImplementedException();
    }

    public override bool ValidateUser(string username, string password)
    {
        throw new NotImplementedException();
    }

    public override int MinRequiredPasswordLength
    {
        get { throw new NotImplementedException(); }
    }

    public override bool RequiresUniqueEmail
    {
        get { throw new NotImplementedException(); }
    }

    public override string GetUserNameByEmail(string email)
    {
        throw new NotImplementedException();
    }
  }
}
4

1 回答 1

0

你可以只实现这个方法FindUsersByEmailMethod

它在 MembershipProvider 中声明为抽象

链接: http: //msdn.microsoft.com/fr-fr/library/system.web.security.membershipprovider.findusersbyemail (v=vs.80).aspx

链接有关您的自定义提供程序的所有方法:

http://msdn.microsoft.com/fr-fr/library/system.web.security.membershipprovider_methods(v=vs.80).aspx

添加此代码

public override MembershipUserCollection FindUsersByEmail (
    string emailToMatch,
    int pageIndex,
    int pageSize,
    out int totalRecords
)
{
  .....
}
于 2012-09-19T14:46:53.003 回答