configuration section confusion

G

Guest

I'm trying to configure email parameters in a web.config:

<configSections>
<sectionGroup name="contactForm">
<section name="email"
type="System.Configuration.NameValueSectionHandler,...
</sectionGroup>
</configSections>

<contactForm>
<email>
<add key="toaddress" value="(e-mail address removed)" />
<add key="subjectprefix" value="RideMatchEntry: " />
<add key="smtphost" value="mail.myhost.net" />
<add key="RideFindEmail" value="(e-mail address removed)"></add>
</email>
</contactForm>

When I use this code I find that variable cs is null:
ConfigurationSection cs = (ConfigurationSection)
WebConfigurationManager.GetSection("email");

Also, how do I add more than one address, can I add multiple "fromaddress"
keys or do they have to be unique? Thoroughly clueless, thanks for any
insight.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top