ContextUtil.IsSecurityEnabled Property

 

Gets a value that indicates whether role-based security is active in the current context.

Namespace:   System.EnterpriseServices
Assembly:  System.EnterpriseServices (in System.EnterpriseServices.dll)

public static bool IsSecurityEnabled { get; }

Property Value

Type: System.Boolean

true if the current context has security enabled; otherwise, false.

Exception Condition
COMException

There is no COM+ context available.

The following code example gets the value of a IsSecurityEnabled property.

[SecurityRole("Role1")]
public class ContextUtil_IsSecurityEnabled : ServicedComponent
{
    public void Example()
    {
        // Display whether role-based security is active for the current COM+
        // context.
        Console.WriteLine("Role-based security active in current context: {0}",
            ContextUtil.IsSecurityEnabled);
    }
}

.NET Framework
Available since 1.1
Return to top
Show: