AuthorizationRule.Action Propriété

Définition

Obtient ou définit l’action AuthorizationRule .

public:
 property System::Web::Configuration::AuthorizationRuleAction Action { System::Web::Configuration::AuthorizationRuleAction get(); void set(System::Web::Configuration::AuthorizationRuleAction value); };
public System.Web.Configuration.AuthorizationRuleAction Action { get; set; }
member this.Action : System.Web.Configuration.AuthorizationRuleAction with get, set
Public Property Action As AuthorizationRuleAction

Valeur de propriété

Une des AuthorizationRuleAction valeurs.

Exemples

L’exemple de code suivant montre comment utiliser cette propriété.

 // Using the AuthorizationRuleCollection Add method.

 // Set the action property.
 authorizationRule.Action = 
    AuthorizationRuleAction.Allow;
 // Define the new rule to add to the collection.
 authorizationRule.Users.Add("userName");
 authorizationRule.Roles.Add("admin");
 authorizationRule.Verbs.Add("POST");

 // Add the new rule to the collection.
 authorizationSection.Rules.Add(authorizationRule);
' Using the AuthorizationRuleCollection Add method.
' Set the action property.
  authorizationRule.Action = _
  AuthorizationRuleAction.Allow
' Define the new rule to add to the collection.
authorizationRule.Users.Add("userName")
authorizationRule.Roles.Add("admin")
authorizationRule.Verbs.Add("POST")

' Add the new rule to the collection.
authorizationSection.Rules.Add(authorizationRule)

Remarques

Au moment de l’exécution, le module d’autorisation effectue une itération et allowdeny des éléments jusqu’à ce qu’il trouve la première règle d’accès qui correspond à un utilisateur particulier. Il accorde ou refuse ensuite l’accès à une ressource d’URL selon que la première règle d’accès trouvée est allow ou deny. L’accès est autorisé par défaut.

S’applique à