SecureEnvironment 類別

定義

表示使用者啟動、授權繫結程序及其他權限管理作業的安全用戶端工作階段。

C#
[System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)]
public class SecureEnvironment : IDisposable
C#
public class SecureEnvironment : IDisposable
繼承
SecureEnvironment
屬性
實作

範例

下列範例顯示 類別的使用 SecureEnvironment

C#
string applicationManifest = "<manifest></manifest>";
if (File.Exists("rpc.xml"))
{
    StreamReader manifestReader = File.OpenText("rpc.xml");
    applicationManifest = manifestReader.ReadToEnd();
}

if (_secureEnv == null)
{
    if (SecureEnvironment.IsUserActivated(new ContentUser(
                _currentUserId, AuthenticationType.Windows)))
    {
        _secureEnv = SecureEnvironment.Create(
            applicationManifest, new ContentUser(
                _currentUserId, AuthenticationType.Windows));
    }
    else
    {
        _secureEnv = SecureEnvironment.Create(
            applicationManifest,
            AuthenticationType.Windows,
            UserActivationMode.Permanent);
    }
}

備註

如同其他類型的 System.Security.RightsManagementSecureEnvironment 只能在完全信任應用程式中使用。

屬性

ApplicationManifest

取得建立 ApplicationManifest 時指定的 SecureEnvironment

User

取得建立 SecureEnvironment 時指定的使用者或使用者群組。

方法

Create(String, AuthenticationType, UserActivationMode)

建立獲得應用程式權限資訊清單的安全用戶端工作階段,AuthenticationTypeUserActivationMode

Create(String, ContentUser)

以指定權限資訊清單為指定的使用者建立安全用戶端工作階段。

Dispose()

釋放 SecureEnvironment 所使用的所有資源。

Dispose(Boolean)

釋放 SecureEnvironment 所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetActivatedUsers()

傳回已啟動使用者的清單。

GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
IsUserActivated(ContentUser)

表示是否已啟用指定使用者存取權限管理內容。

MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
RemoveActivatedUser(ContentUser)

為指定的使用者移除授權啟用。

ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於

產品 版本
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9