0

Why can't I read this from my web config? When I used App.config it worked fine..

FundGroups = null

private static readonly NameValueCollection FundGroups =
        (NameValueCollection)ConfigurationManager.GetSection("FundGroups");

Web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>

<configSections>
    <section name="FundGroups" type="System.Configuration.NameValueSectionHandler" />
</configSections>

<FundGroups>
<add key="Group1" value="Value1" />
<add key="Group2" value="Value2" />
<add key="Group3" value="Value3" />
<add key="Group4" value="Value4" />
<add key="Group5" value="Value5" />
<add key="Group6" value="Value6" />
<add key="Group7" value="Value7" />
</FundGroups>


</configuration>

I found a possible duplication here. But the ConfigurationSettings.GetConfig seems to be obsolete and doesnt work for me

Community
  • 1
  • 1
MrProgram
  • 5,044
  • 13
  • 58
  • 98
  • 1
    Possible duplicate of [How to get the values of a ConfigurationSection of type NameValueSectionHandler](http://stackoverflow.com/questions/3461418/how-to-get-the-values-of-a-configurationsection-of-type-namevaluesectionhandler) – Anıl Okay Nov 18 '15 at 13:29
  • The answer there, by using ConfigurationSettings.GetConfig is obsolete... – MrProgram Nov 18 '15 at 13:35

0 Answers0