SecureEnvironment.User Property

Definition

Gets the user or user-group specified when the SecureEnvironment was created.

public System.Security.RightsManagement.ContentUser User { get; }

Property Value

The user or user-group specified to the Create(String, ContentUser) method when the SecureEnvironment was created.

Examples

The following example shows use of the User property

ShowStatus("   Initiating SecureEnvironment as user: \n       " +
    currentUserId + " [" + _authentication + "]");
if (SecureEnvironment.IsUserActivated(
    new ContentUser(currentUserId, _authentication)))
{
    ShowStatus("   User is already activated.");
    _secureEnv = SecureEnvironment.Create(applicationManifest,
                    new ContentUser(currentUserId, _authentication));
}
else // if user is not yet activated.
{
    ShowStatus("   User is NOT activated,\n       activating now....");
    // If using the current Windows user, no credentials are
    // required and we can use UserActivationMode.Permanent.
    _secureEnv = SecureEnvironment.Create(applicationManifest,
                    _authentication, UserActivationMode.Permanent);

    // If not using the current Windows user, use
    // UserActivationMode.Temporary to display the Windows
    // credentials pop-up window.
    ///_secureEnv = SecureEnvironment.Create(applicationManifest,
    ///     a_authentication, UserActivationMode.Temporary);
}
ShowStatus("   Created SecureEnvironment for user:\n       " +
    _secureEnv.User.Name +
    " [" + _secureEnv.User.AuthenticationType + "]");

Applies to

מוצר גירסאות
.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

See also