when I execute this code I only get the 2nd value. I never get the 1st and
2nd value. Anyone know why?
private void Button2_Click(object sender, System.EventArgs e)
{
System.Collections.Specialized.NameValueCollection colNameVal;
colNameVal = System.Configuration.ConfigurationSettings.AppSett ings;
foreach(string strKeysValue in colNameVal.GetValues("ServersInCluster"))
{
Response.Write(strKeysValue);
}
}
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/Fo...sp-net/200601/1AppSettings is a simplified model and does not provide for multiple duplicate
key names.
You need to use a custom configuration section and associated handler.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"Andy Sutorius via DotNetMonster.com" wrote:
> I have 2 values in the web.config with a key of ServersInCluster. However
> when I execute this code I only get the 2nd value. I never get the 1st and
> 2nd value. Anyone know why?
> private void Button2_Click(object sender, System.EventArgs e)
> {
> System.Collections.Specialized.NameValueCollection colNameVal;
> colNameVal = System.Configuration.ConfigurationSettings.AppSett ings;
> foreach(string strKeysValue in colNameVal.GetValues("ServersInCluster"))
> {
> Response.Write(strKeysValue);
> }
> }
> --
> Message posted via DotNetMonster.com
> http://www.dotnetmonster.com/Uwe/Fo...sp-net/200601/1
Thank you.
Peter Bromberg [C# MVP] wrote:
>AppSettings is a simplified model and does not provide for multiple duplicate
>key names.
>You need to use a custom configuration section and associated handler.
>Peter
>> I have 2 values in the web.config with a key of ServersInCluster. However
>> when I execute this code I only get the 2nd value. I never get the 1st and
>[quoted text clipped - 10 lines]
>> }
>> }
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/Fo...sp-net/200601/1
0 comments:
Post a Comment