Custom Profile会员提供商

时间:2012-09-19 13:59:53

标签: c# asp.net asp.net-profiles

我有一个自定义成员资格提供程序,我正在使用我正在开发的网站,我有很多错误,他们都在谈论正在使用的方法。以下是其中一个错误:

错误#'WebOrder.CustomMembershipProvider'未实现继承的抽象成员'System.Web.Security.MembershipProvider.FindUsersByEmail(string,int,int,out int)'C:\ Users \ Jschoff \ Documents \ Visual Studio 2010 \项目\ WebOrder \ WebOrder \模型\ 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();
    }
  }
}

1 个答案:

答案 0 :(得分:0)

您可以实现此方法FindUsersByEmail方法

它在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
)
{
  .....
}