Nous pouvons récupérer des sections de configuration à partir web.config des deux façons suivantes:sections de configuration Récupération par WebConfigurationManager et objets de configuration
Configuration config = WebConfigurationManager.OpenWebConfiguration("/");
AuthenticationSection authSection = (AuthenticationSection)
config.GetSection(@"system.web/authentication");
OU
AuthenticationSection authSection = (AuthenticationSection)
WebConfigurationManager.GetSection(@"system.web/authentication");
Comment sont les deux approches différentes (en plus de la fait que dans le premier exemple nous avons récupéré une section de configuration via l'objet Configuration, qui représente un fichier de configuration)?
thanx
Je pensais qu'il y avait peut-être une différence par rapport à quel fichier web.config la section d'authentification est récupérée. Dans le premier cas, elle est extraite de la racine web.config, mais dans le second cas elle peut être récupérée Fichier .config (s'il existe) – carewithl
Ils ouvrent tous deux le fichier web.config par défaut pour l'application en cours (en fonction du dossier existant), démarrent à la racine et recherchent system.web/authentication. –
merci de m'aider – carewithl