diff --git a/src/FSharp.Configuration/AppSettingsProvider.fs b/src/FSharp.Configuration/AppSettingsProvider.fs index 9591b1b2..c7368c9d 100644 --- a/src/FSharp.Configuration/AppSettingsProvider.fs +++ b/src/FSharp.Configuration/AppSettingsProvider.fs @@ -8,16 +8,21 @@ open System open System.Configuration open System.Collections.Generic open System.Globalization -open System.IO + +let private getConfig() = + if Web.HttpContext.Current <> null && not (Web.HttpContext.Current.Request.PhysicalPath = "") then + Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~") + else + ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None) let getConfigValue(key) = - let settings = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).AppSettings.Settings + let settings = getConfig().AppSettings.Settings settings.[key].Value let setConfigValue(key, value) = - let settings = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None) - settings.AppSettings.Settings.[key].Value <- value - settings.Save() + let config = getConfig() + config.AppSettings.Settings.[key].Value <- value + config.Save() let getConnectionString(key: string) = let connectionStrings = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).ConnectionStrings.ConnectionStrings diff --git a/src/FSharp.Configuration/FSharp.Configuration.fsproj b/src/FSharp.Configuration/FSharp.Configuration.fsproj index 5c4631a3..cac86a14 100644 --- a/src/FSharp.Configuration/FSharp.Configuration.fsproj +++ b/src/FSharp.Configuration/FSharp.Configuration.fsproj @@ -1,4 +1,4 @@ - + @@ -26,7 +26,8 @@ Program C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe - l:\git\FSharp.Configuration\FSharp.Configuration.Tests.sln + + pdbonly @@ -48,6 +49,7 @@ +