다음을 통해 공유


WebPartsPersonalization.Authorization 속성

정의

현재 웹 애플리케이션의 웹 파트 개인 설정 인증이 포함되어 있는 AuthorizationSection 개체를 가져옵니다.

public:
 property System::Web::Configuration::WebPartsPersonalizationAuthorization ^ Authorization { System::Web::Configuration::WebPartsPersonalizationAuthorization ^ get(); };
[System.Configuration.ConfigurationProperty("authorization")]
public System.Web.Configuration.WebPartsPersonalizationAuthorization Authorization { get; }
[<System.Configuration.ConfigurationProperty("authorization")>]
member this.Authorization : System.Web.Configuration.WebPartsPersonalizationAuthorization
Public ReadOnly Property Authorization As WebPartsPersonalizationAuthorization

속성 값

WebPartsPersonalizationAuthorization

현재 웹 애플리케이션의 웹 파트 개인 설정 인증이 포함되어 있는 AuthorizationSection 개체입니다.

특성

예제

다음 코드 예제에서는 Authorization 속성을 사용하는 방법을 보여 줍니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 WebPartsSection 클래스입니다.

// Add an authorization.
AuthorizationRule ar = 
    new AuthorizationRule(AuthorizationRuleAction.Allow);
ar.Verbs.Add("ModifyState");
ar.Users.Add("Admin");
webPartsSection.Personalization.Authorization.Rules.Add(ar);

// List current authorizations.
for (int ai = 0;
    ai < webPartsSection.Personalization.Authorization.Rules.Count; 
    ai++)
{
    Console.WriteLine("  #{0}:", ai);
    AuthorizationRule aRule = 
        webPartsSection.Personalization.Authorization.Rules[ai];
    Console.WriteLine("  Verbs=");
    foreach (string verb in aRule.Verbs)
        Console.WriteLine("    * {0}", verb);
    Console.WriteLine("  Roles=");
    foreach (string role in aRule.Roles)
        Console.WriteLine("    * {0}", role);
    Console.WriteLine("  Users=");
    foreach (string user in aRule.Users)
        Console.WriteLine("    * {0}", user);
}
' Add an authorization.
Dim ar As AuthorizationRule = _
  New AuthorizationRule(AuthorizationRuleAction.Allow)
ar.Verbs.Add("ModifyState")
ar.Users.Add("Admin")
webPartsSection.Personalization.Authorization.Rules.Add(ar)

' List current authorizations.
Dim ai As Integer
For ai = 0 To _
  webPartsSection.Personalization.Authorization.Rules.Count
    Console.WriteLine("  #{0}:", ai)
    Dim aRule As AuthorizationRule = _
      webPartsSection.Personalization.Authorization.Rules(ai)
    Console.WriteLine("  Verbs=")
    Dim verb As String
    For Each verb In aRule.Verbs
      Console.WriteLine("    * {0}", verb)
      Console.WriteLine("  Roles=")
    Next
    Dim role As String
    For Each role In aRule.Roles
      Console.WriteLine("    * {0}", role)
      Console.WriteLine("  Users=")
    Next
    Dim user As String
    For Each user In aRule.Users
      Console.WriteLine("    * {0}", user)
    Next
Next

설명

컬렉션의 각 AuthorizationRule 개체와 연결된 유효한 동사가 하나 이상 있어야 합니다.

적용 대상