共用方式為


RoleProvider.ApplicationName 屬性

定義

取得或設定應用程式名稱以儲存及檢索角色資訊。

public:
 abstract property System::String ^ ApplicationName { System::String ^ get(); void set(System::String ^ value); };
public abstract string ApplicationName { get; set; }
member this.ApplicationName : string with get, set
Public MustOverride Property ApplicationName As String

屬性值

應用程式名稱,用於儲存和檢索角色資訊。

範例

以下程式碼範例展示了該 ApplicationName 屬性的範例實作。

private string pApplicationName;

public override string ApplicationName
{
  get { return pApplicationName; }
  set { pApplicationName = value; }
}
Private pApplicationName As String

Public Overrides Property ApplicationName As String 
  Get
    Return pApplicationName
  End Get
  Set
    pApplicationName = value
  End Set
End Property

備註

類別用RolesApplicationName將使用者和角色與不同應用程式關聯起來。 這使得多個應用程式能使用同一個資料庫來儲存使用者與角色資訊,而不會發生重複使用者名稱或角色名稱之間的衝突。 多個 ASP.NET 應用程式可以透過在屬性中指定相同的值 ApplicationName 來使用同一個資料庫。 此 ApplicationName 屬性可透過程式設定,或在網頁應用程式的設定檔中使用 applicationName 屬性以宣告式設定。

若未 ApplicationName 指定房產,建議使用房產 ApplicationVirtualPath 價值。

適用於

另請參閱