Searching StackOverflow, I found this question on how to restore SMTP settings from Web.Config , but there are no details on how to update SMTP to a web.config file.
I started with the following code:
Configuration webConfig = WebConfigurationManager.OpenWebConfiguration("~"); MailSettingsSectionGroup settings = (MailSettingsSectionGroup)webConfig.GetSectionGroup("system.net/mailSettings"); SmtpSection smtp = settings.Smtp; SmtpNetworkElement net = smtp.Network;
but was quickly associated with Intellisense that SmptSection.Network is a Get accessory (aka read-only).
So, how should I programmatically write SMTP data back to web.config?
source share