Is it possible to modify configuration ConnectionStrings at runtime?
Is it possible to modify the connectionstrings defined in the app.config/web.config at runtime? I want to use different configfiles depending on the machine the app/site is run on (only for debugging purposes, of course. We'll use the regular config files when deployed). I can write AppSettings, but not ConnectionStrings (AFAIK). Or can I? Yes it's possible, but AFAIK only via Reflection. The following code should do what you need (read below for usage): public static string SetConnectionString(Type assemblyMember, Type settingsClass, string newConnectionString, string connectionStringKey) {