Monday, November 26, 2007

Update Web.config + Asp.net VB.net

Ever needed to update the web.config dynamically?

Make sure you add a reference at the top of the page to

Imports System.Web.Configuration


Dim value As String = "mskilton@gmail.com"

Dim config As Configuration =
webConfigurationManager.OpenWebConfiguration("~")
Dim appsetting As AppSettingsSection =
config.GetSection("appSettings")

appsetting.Settings("emailaddress").Value = value

config.Save()


Have fun updating your web.config programmatically!

1 comment:

Justin said...

Just what I was looking for thank you!