ASP.NET Configuration

WebConfiguratonManger

https://msdn.microsoft.com/en-us/library/system.web.configuration.webconfigurationmanager.connectionstrings.aspx

private 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();
        System.Diagnostics.Debug.WriteLine("Key: {0} Value: {1}",
        key, appSettings[key]);
        i += 1;
    }
}

results matching ""

    No results matching ""