WebPartsPersonalization.Authorization Property

 

Gets an AuthorizationSection object containing the Web Parts personalization authorizations for the current Web application.

Namespace:   System.Web.Configuration
Assembly:  System.Web (in System.Web.dll)

<ConfigurationPropertyAttribute("authorization")>
Public ReadOnly Property Authorization As WebPartsPersonalizationAuthorization

Property Value

Type: System.Web.Configuration.WebPartsPersonalizationAuthorization

An AuthorizationSection object containing the Web Parts personalization authorizations for the current Web application.

There must be at least one valid verb associated with each AuthorizationRule object in the collection.

The following code example shows how to use the Authorization property. This code example is part of a larger example provided for the WebPartsSection class.

' 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

.NET Framework
Available since 2.0
Return to top
Show: