FormsAuthenticationUserCollection.Get 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取指定的 FormsAuthenticationUser 集合元素。
重载
Get(String) |
获取具有指定名称的 FormsAuthenticationUser 集合元素。 |
Get(Int32) |
获取指定索引处的 FormsAuthenticationUser 集合元素。 |
Get(String)
获取具有指定名称的 FormsAuthenticationUser 集合元素。
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
用户名。
返回
包含用户名和密码的 FormsAuthenticationUser 对象。
示例
下面的代码示例演示如何访问具有指定名称的用户的凭据。
// 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 集合元素。
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
集合用户的索引。
返回
包含用户名和密码的 FormsAuthenticationUser。
示例
下面的代码示例演示如何在指定索引处访问用户的凭据。
// 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)