For some time now I’ve been storing my connection and app settings in an external file and just referencing that file via my web.config. This works really well because it allows me to keep separate connection strings and app settings. This is really handy since I find during development I will often make many changes to the webconfig and I hate having to manage the environment specific values every time I need to update my web.config.
Is there anyway I can achieve this with he SMTP configuration sections in the web.config.
Sure, you can use the configSource attribute.
Example:
Then put your mailSettings configuration data in MailSettings.config
So then your MailSettings.config file would have something like:
Update: looks like it may need to actually go in the smtp node to work properly, so I’ve updated the above code to indicate that – same idea, only this one should work. 🙂