共用方式為


ProcessModelSection.UserName 屬性

定義

取得或設定值,表示 Windows 識別的使用者名稱。

public:
 property System::String ^ UserName { System::String ^ get(); void set(System::String ^ value); };
[System.Configuration.ConfigurationProperty("userName", DefaultValue="machine")]
public string UserName { get; set; }
[<System.Configuration.ConfigurationProperty("userName", DefaultValue="machine")>]
member this.UserName : string with get, set
Public Property UserName As String

屬性值

使用者名稱。 預設值為 Machine。

屬性

範例

下列程式碼範例示範如何存取 UserName 屬性。


// Get the current UserName property value.
string userName = 
  processModelSection.UserName;

// Set the UserName property to "CustomUser".
processModelSection.UserName = "CustomUser";
' Get the current UserName property value.
   Dim userName As String = _
   processModelSection.UserName

' Set the UserName property to "CustomUser".
processModelSection.UserName = "CustomUser"

備註

如果存在,則會 UserName 定義與預設進程不同的 Windows 身分識別。 此身分識別可用來執行 ASP.NET 背景工作進程。

根據預設,會 UserName 設定為特殊值 Machine,而進程會在安裝 ASP.NET 時自動建立的 ASPNET 使用者帳戶下執行。

屬性 Password 必須與 屬性搭配 UserName 使用。

當存在時,這些屬性值會導致背景工作進程以設定的 Windows 身分識別執行。

注意

UserName如果 屬性設定為 System,並使用密碼自動產生,它會定義以系統管理帳戶身分執行進程的實體,並允許在進程下執行的所有 ASP.NET 使用者程式碼具有完整的系統管理許可權。 因此,請密切注意此案例,以取得允許的許可權。

適用於