SecureEnvironment 類別
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示使用者啟動、授權繫結程序及其他權限管理作業的安全用戶端工作階段。
public ref class SecureEnvironment : IDisposable
C#
[System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)]
public class SecureEnvironment : IDisposable
C#
public class SecureEnvironment : IDisposable
[<System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)>]
type SecureEnvironment = class
interface IDisposable
type SecureEnvironment = class
interface IDisposable
Public Class SecureEnvironment
Implements 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);
}
}
Dim applicationManifest As String = "<manifest></manifest>"
If File.Exists("rpc.xml") Then
Dim manifestReader As StreamReader = File.OpenText("rpc.xml")
applicationManifest = manifestReader.ReadToEnd()
End If
If _secureEnv Is Nothing Then
If SecureEnvironment.IsUserActivated(New ContentUser(_currentUserId, AuthenticationType.Windows)) Then
_secureEnv = SecureEnvironment.Create(applicationManifest, New ContentUser(_currentUserId, AuthenticationType.Windows))
Else
_secureEnv = SecureEnvironment.Create(applicationManifest, AuthenticationType.Windows, UserActivationMode.Permanent)
End If
End If
如同其他類型的 System.Security.RightsManagement , SecureEnvironment 只能在完全信任應用程式中使用。
Application |
取得建立 ApplicationManifest 時指定的 SecureEnvironment。 |
User |
取得建立 SecureEnvironment 時指定的使用者或使用者群組。 |
Create(String, Authentication |
建立獲得應用程式權限資訊清單的安全用戶端工作階段,AuthenticationType 和 UserActivationMode。 |
Create(String, Content |
以指定權限資訊清單為指定的使用者建立安全用戶端工作階段。 |
Dispose() |
釋放 SecureEnvironment 所使用的所有資源。 |
Dispose(Boolean) |
釋放 SecureEnvironment 所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。 |
Equals(Object) |
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
Get |
傳回已啟動使用者的清單。 |
Get |
做為預設雜湊函式。 (繼承來源 Object) |
Get |
取得目前執行個體的 Type。 (繼承來源 Object) |
Is |
表示是否已啟用指定使用者存取權限管理內容。 |
Memberwise |
建立目前 Object 的淺層複製。 (繼承來源 Object) |
Remove |
為指定的使用者移除授權啟用。 |
To |
傳回代表目前物件的字串。 (繼承來源 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 |