SecureEnvironment 类 
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示一个用于用户激活、许可证绑定和其他权限管理操作的安全客户端会话。
public ref class SecureEnvironment : IDisposable
	[System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)]
public class SecureEnvironment : IDisposable
	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 类
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 仅在完全信任应用程序中可用。
属性
| ApplicationManifest | 
		 获取创建 ApplicationManifest 时指定的 SecureEnvironment。  | 
        	
| User | 
		 获取创建 SecureEnvironment 时指定的用户或用户组。  | 
        	
方法
| Create(String, AuthenticationType, UserActivationMode) | 
		 创建给定了应用程序权限清单 AuthenticationType 和 UserActivationMode 的安全客户端会话。  | 
        	
| Create(String, ContentUser) | 
		 使用给定权限清单为指定用户创建安全客户端会话。  | 
        	
| Dispose() | 
		 释放由 SecureEnvironment 使用的所有资源。  | 
        	
| Dispose(Boolean) | 
		 释放由 SecureEnvironment 占用的非托管资源,还可以另外再释放托管资源。  | 
        	
| Equals(Object) | 
		 确定指定对象是否等于当前对象。 (继承自 Object) | 
        	
| GetActivatedUsers() | 
		 返回激活用户的列表。  | 
        	
| GetHashCode() | 
		 作为默认哈希函数。 (继承自 Object) | 
        	
| GetType() | 
		 获取当前实例的 Type。 (继承自 Object) | 
        	
| IsUserActivated(ContentUser) | 
		 表示是否已激活访问权限管理内容的给定用户。  | 
        	
| MemberwiseClone() | 
		 创建当前 Object 的浅表副本。 (继承自 Object) | 
        	
| RemoveActivatedUser(ContentUser) | 
		 删除指定用户的许可证激活。  | 
        	
| ToString() | 
		 返回表示当前对象的字符串。 (继承自 Object) |