共用方式為


FormsAuthenticationUser.Name 屬性

定義

取得或設定登入使用者名稱。

public:
 property System::String ^ Name { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.TypeConverter(typeof(System.Web.Configuration.LowerCaseStringConverter))]
[System.Configuration.ConfigurationProperty("name", DefaultValue="", IsKey=true, IsRequired=true)]
[System.Configuration.StringValidator]
public string Name { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Web.Configuration.LowerCaseStringConverter))>]
[<System.Configuration.ConfigurationProperty("name", DefaultValue="", IsKey=true, IsRequired=true)>]
[<System.Configuration.StringValidator>]
member this.Name : string with get, set
Public Property Name As String

屬性值

應用程式所需要的登入使用者名稱。

屬性

範例

下列程式碼範例示範如何使用 Name 屬性。 請參閱類別主題中的 FormsAuthenticationUser 程式碼範例,以瞭解如何取得區段。


// Using the Name property.

// Get current name.
string currentName = 
    formsAuthenticationUsers[0].Name;

// Set a new name.
formsAuthenticationUsers[0].Name = "userName";
' Using the Name property.
' Get current name.
  Dim currentName As String = _
  formsAuthenticationUsers(0).Name

' Set a new name.
formsAuthenticationUsers(0).Name = "userName"

適用於