Jun
26
Written by:
Steve Gray
6/26/2009 11:30 AM
This is another of those cases where the code is pretty simple, but it helps to have a template someplace to copy the code from. So, here’s my template
If you need something in VB.NET or ASP.NET to be configurable, the easy thing to do is to put it in the .config file and let the user configure it.
Add this code to the config file:
<configuration>
<configSections>
...
</configSections>
<appSettings>
<add key="live" value="somevalue" />
<add key="dev" value="some other value" />
</appSettings>
And you call it like this:
Dim strConnect As String = System.Configuration.ConfigurationManager.AppSettings("live")
As always, I welcome your comments!