Hi,
I have followed your example and it worked, thanks. However what I want to do is to override the settings in web.config for some others,
to persist in teh website. So I am trying to do something like this in Application_Start:
Configuration configurationFile =
System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/web.config");
System.Net.Configuration.MailSettingsSectionGroup mailSettings =
configurationFile.GetSectionGroup("system.net/mailSettings") as
System.Net.Configuration.MailSettingsSectionGroup;
if (mailSettings != null)
{
mailSettings.Smtp.Network.Port = aPort;
mailSettings.Smtp.Network.Host = aHost;
mailSettings.Smtp.Network.Password = aPassword;
mailSettings.Smtp.Network.UserName = aUserName;
}
However my changes don't persist and when I send an email it defaults to what's in web.config. Any idea what I am doing wrong?
Thanks