FormsAuthenticationUserCollection.Get 方法

定义

获取指定的 FormsAuthenticationUser 集合元素。Gets the specified FormsAuthenticationUser collection element.

重载

Get(String)

获取具有指定名称的 FormsAuthenticationUser 集合元素。Gets the FormsAuthenticationUser collection element with the specified name.

Get(Int32)

获取指定索引处的 FormsAuthenticationUser 集合元素。Gets the FormsAuthenticationUser collection element at the specified index.

Get(String)

获取具有指定名称的 FormsAuthenticationUser 集合元素。Gets the FormsAuthenticationUser collection element with the specified name.

public:
 System::Web::Configuration::FormsAuthenticationUser ^ Get(System::String ^ name);
public System.Web.Configuration.FormsAuthenticationUser Get (string name);
member this.Get : string -> System.Web.Configuration.FormsAuthenticationUser
Public Function Get (name As String) As FormsAuthenticationUser

参数

name
String

用户名。The user's name.

返回

FormsAuthenticationUser

包含用户名和密码的 FormsAuthenticationUser 对象。A FormsAuthenticationUser object that contains the user name and password.

示例

下面的代码示例演示如何使用指定名称访问用户的凭据。The following code example shows how to access credentials of a user with the specified name.

// Get the user with the specified name.
FormsAuthenticationUser storedUser = 
    formsAuthenticationCredentials.Users.Get("userName");

' Get the user with the specified name.
  Dim storedUser As FormsAuthenticationUser = _
  formsAuthenticationCredentials.Users.Get("userName")

适用于

Get(Int32)

获取指定索引处的 FormsAuthenticationUser 集合元素。Gets the FormsAuthenticationUser collection element at the specified index.

public:
 System::Web::Configuration::FormsAuthenticationUser ^ Get(int index);
public System.Web.Configuration.FormsAuthenticationUser Get (int index);
member this.Get : int -> System.Web.Configuration.FormsAuthenticationUser
Public Function Get (index As Integer) As FormsAuthenticationUser

参数

index
Int32

集合用户的索引。The collection user's index.

返回

FormsAuthenticationUser

包含用户名和密码的 FormsAuthenticationUserA FormsAuthenticationUser that contains the user name and password.

示例

下面的代码示例演示如何访问指定索引处的用户的凭据。The following code example shows how to access credentials of a user at the specified index.

// Get the user at the specified index.
FormsAuthenticationUser storedUser2 = 
    formsAuthenticationCredentials.Users.Get(0);

' Get the user at the specified index.
  Dim storedUser2 As FormsAuthenticationUser = _
  formsAuthenticationCredentials.Users.Get(0)

适用于