I'm not sure which section this should reside.
I've got a custom section declared within my web.config.
[code]
[/code]
and this after
[code][/code]
When I try and getSection("MyAppSettings"), the object returns as null. Does anyone have an idea where I'm going wrong. I tried this on my local machine and it worked fine.
this is working for me:
[code]WebConfigurationManager.GetSection("system.net/mailSettings/smtp") as SmtpSection[/code]
what looks strange to me is the "NameValueFileSectionHandler" that you're using:
i think (according to this msdn entry) it's not what you are looking for.
to the end of the web config file and it's working now! I had it just under the configSections declaration before. I can't believe I didn't try that in the first place! :d/
Custom Section in web.config
Hi,
I'm not sure which section this should reside.
I've got a custom section declared within my web.config.
[code]
[/code]
and this after
[code][/code]
When I try and getSection("MyAppSettings"), the object returns as null. Does anyone have an idea where I'm going wrong. I tried this on my local machine and it worked fine.
Thanks in advance!
this is working for me:
[code]WebConfigurationManager.GetSection("system.net/mailSettings/smtp") as SmtpSection[/code]
what looks strange to me is the "NameValueFileSectionHandler" that you're using:
i think (according to this msdn entry) it's not what you are looking for.
maybe you wanna try the KeyValueConfigurationCollection
Hi roberkules,
I moved the
[code][/code]
to the end of the web config file and it's working now! I had it just under the configSections declaration before. I can't believe I didn't try that in the first place! :d/
if you have time you could also look into creating custom ConfigurationSections with custom ConfigurationElements
i'm using it now and it's nice because you are not limited to name/value collections and you can even specify the type of the values
cheers,
robert
is working on a reply...