WebConfigurationManager.AppSettings (Propiedad)
Obtiene los datos de AppSettingsSection para la configuración predeterminada de la aplicación Web actual.
Espacio de nombres: System.Web.Configuration
Ensamblado: System.Web (en system.web.dll)
Ensamblado: System.Web (en system.web.dll)
Valor de propiedad
Objeto NameValueCollection que contiene el objeto AppSettingsSection para la configuración predeterminada de la aplicación Web actual.En el ejemplo de código siguiente se muestra cómo obtener acceso a la información de configuración con el método AppSettings.
// Show the use of AppSettings. // It gets the section from the configuration // file located at the application current level. static void GetAppSettings() { // Get the appSettings key,value pairs collection. NameValueCollection appSettings = WebConfigurationManager.AppSettings as NameValueCollection; // Get the collection enumerator. IEnumerator appSettingsEnum = appSettings.GetEnumerator(); // Loop through the collection and // display the appSettings key, value pairs. int i = 0; Console.WriteLine("[Display appSettings]"); while (appSettingsEnum.MoveNext()) { string key = appSettings.AllKeys[i].ToString(); Console.WriteLine("Key: {0} Value: {1}", key, appSettings[key]); i += 1; } Console.WriteLine(); }
Windows 98, Windows 2000 Service Pack 4, Windows CE, Windows Millennium, Windows Mobile para Pocket PC, Windows Mobile para Smartphone, Windows Server 2003, Windows XP Media Center, Windows XP Professional x64, Windows XP SP2, Windows XP Starter
Microsoft .NET Framework 3.0 es compatible con Windows Vista, Microsoft Windows XP SP2 y Windows Server 2003 SP1.