ContextUtil.IsSecurityEnabled 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得值,指出以角色為基礎的安全性在目前內容中是否為作用中。
public:
static property bool IsSecurityEnabled { bool get(); };
public static bool IsSecurityEnabled { get; }
static member IsSecurityEnabled : bool
Public Shared ReadOnly Property IsSecurityEnabled As Boolean
屬性值
如果目前內容已經啟用安全性,則為 true
,否則為 false
。
例外狀況
沒有 COM+ 內容可供使用。
範例
下列程式代碼範例會取得 屬性的值 IsSecurityEnabled 。
[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