ContextUtil.IsSecurityEnabled Eigenschaft

Definition

Ruft einen Wert ab, der angibt, ob im aktuellen Kontext die rollenbasierte Sicherheit aktiviert ist.

public:
 static property bool IsSecurityEnabled { bool get(); };
public static bool IsSecurityEnabled { get; }
member this.IsSecurityEnabled : bool
Public Shared ReadOnly Property IsSecurityEnabled As Boolean

Eigenschaftswert

Boolean

true, wenn die Sicherheit im aktuellen Kontext aktiviert ist, andernfalls false.

Ausnahmen

Es ist kein COM+-Kontext verfügbar.

Beispiele

Im folgenden Codebeispiel wird der Wert einer IsSecurityEnabled Eigenschaft abgerufen.

[SecurityRole("Role1")]
public ref class ContextUtil_IsSecurityEnabled: public 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 );
   }
};
[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);
    }
}
<SecurityRole("Role1")>  _
Public Class ContextUtil_IsSecurityEnabled
    Inherits ServicedComponent
    
    Public Sub Example() 
        ' Display whether role-based security is active for the current COM+
        ' context.
        MsgBox("Role-based security active in current context: " & ContextUtil.IsSecurityEnabled)

    End Sub
End Class

Gilt für