ContextUtil.IsSecurityEnabled ContextUtil.IsSecurityEnabled ContextUtil.IsSecurityEnabled ContextUtil.IsSecurityEnabled Property

Определение

Возвращает значение, показывающее, включена ли безопасность на основе ролей в текущем контексте.Gets a value that indicates whether role-based security is active in the current context.

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

Значение свойства

Значение true, если безопасность в текущем контексте включена; в противном случае — значение false.true if the current context has security enabled; otherwise, false.

Исключения

Контекст COM+ недоступен.There is no COM+ context available.

Примеры

В следующем примере кода возвращается значение IsSecurityEnabled свойства.The following code example gets the value of a IsSecurityEnabled property.

[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 'ContextUtil_IsSecurityEnabled

Применяется к