ProfileProvider.FindProfilesByUserName 方法

定义

在派生类中重写后,此方法检索用户名与指定用户名相匹配的配置文件的配置文件信息。

public:
 abstract System::Web::Profile::ProfileInfoCollection ^ FindProfilesByUserName(System::Web::Profile::ProfileAuthenticationOption authenticationOption, System::String ^ usernameToMatch, int pageIndex, int pageSize, [Runtime::InteropServices::Out] int % totalRecords);
public abstract System.Web.Profile.ProfileInfoCollection FindProfilesByUserName (System.Web.Profile.ProfileAuthenticationOption authenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords);
abstract member FindProfilesByUserName : System.Web.Profile.ProfileAuthenticationOption * string * int * int * int -> System.Web.Profile.ProfileInfoCollection
Public MustOverride Function FindProfilesByUserName (authenticationOption As ProfileAuthenticationOption, usernameToMatch As String, pageIndex As Integer, pageSize As Integer, ByRef totalRecords As Integer) As ProfileInfoCollection

参数

authenticationOption
ProfileAuthenticationOption

ProfileAuthenticationOption 值之一,指定是返回匿名配置文件、经过身份验证的配置文件还是同时返回这两种类型的配置文件。

usernameToMatch
String

要搜索的用户名。

pageIndex
Int32

要返回的结果页的索引。

pageSize
Int32

要返回的结果页的大小。

totalRecords
Int32

当此方法返回时,此参数包含配置文件的总数。

返回

包含配置文件中的用户配置文件信息的 ProfileInfoCollection,这些配置文件中的用户名与提供的 usernameToMatch 参数相匹配。

示例

下面的代码示例演示方法实现 FindProfilesByUserName 的方法签名。 有关完整 ProfileProvider 实现的示例,请参阅 如何:生成和运行配置文件提供程序示例

public override ProfileInfoCollection FindProfilesByUserName(
    ProfileAuthenticationOption authenticationOption,
    string usernameToMatch,
    int pageIndex,
    int pageSize,
    out int totalRecords)
{
    totalRecords = 0;

    return new ProfileInfoCollection();
}
Public Overrides Function FindProfilesByUserName( _
ByVal authenticationOption As ProfileAuthenticationOption, _
ByVal usernameToMatch As String, _
ByVal pageIndex As Integer, _
ByVal pageSize As Integer, _
 ByRef totalRecords As Integer) As ProfileInfoCollection

  totalRecords = 0

  Return New ProfileInfoCollection()
End Function

注解

方法 FindProfilesByUserName 返回配置文件的配置文件信息列表,其中用户名与所提供的 usernameToMatch 参数匹配。 applicationName仅返回配置文件中指定的 的数据。 参数 authenticationOption 指定是只搜索匿名配置文件、仅经过身份验证的配置文件还是搜索所有配置文件。

如果数据源支持其他搜索功能(例如通配符),则可以为用户名提供更广泛的搜索功能。

返回 FindProfilesByUserName 的结果受 pageIndexpageSize 参数的约束。 参数pageSize标识在 中ProfileInfoCollection返回的最大对象数ProfileInfo。 参数 pageIndex 标识要返回的结果页,其中 0 表示第一页。 参数totalRecords是一个out参数,它根据 authenticationOptionuserInactiveSinceDate 参数设置为配置的 applicationName非活动用户配置文件总数。 例如,如果配置的 applicationName有 13 个用户,并且 pageIndex 值为 1,值为 pageSize 5, ProfileInfoCollection 则返回的 将包含返回的第六个到第十个非活动配置文件。 参数 totalRecords 将设置为 13。

适用于

另请参阅