This documentation is archived and is not being maintained.

SecureEnvironment.Create Method

Creates a secure client session for rights management operations.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  NameDescription
Public method Static member Create(String, ContentUser) Creates a secure client session for a specified user with a given rights manifest.
Public method Static member Create(String, AuthenticationType, UserActivationMode) Creates a secure client session given an application rights manifest, AuthenticationType, and UserActivationMode.
Top

The following example shows how to use this method to create a secure environment. For the full sample, see Rights Managed Package Publish Sample.

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);
    }
}
Show: