+2008-07-09 Marek Habersack <mhabersack@novell.com>
+
+ * ConfigurationManager.cs: implemented a work-around for
+ OpenExeConfiguration ("") not working with ASP.NET apps properly.
+
2008-07-07 Rodrigo Kumpera <rkumpera@novell.com>
* ConfigurationManager.cs: Return the right path if the calling assembly is
public static class ConfigurationManager
{
+ static bool systemWebInUse;
static InternalConfigurationFactory configFactory = new InternalConfigurationFactory ();
static IInternalConfigSystem configSystem = new ClientConfigurationSystem ();
static object lockobj = new object ();
-
+
[MonoTODO ("Evidence and version still needs work")]
static string GetAssemblyInfo (Assembly a)
{
switch (userLevel) {
case ConfigurationUserLevel.None:
if (exePath == null || exePath.Length == 0) {
- if (calling_assembly != null)
+ if (!systemWebInUse && calling_assembly != null)
exePath = calling_assembly.Location;
else
exePath = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
throw new ArgumentNullException ("newSystem");
lock (lockobj) {
+ // KLUDGE!! We need that when an assembly loaded inside an ASP.NET
+ // domain does OpenExeConfiguration ("") - we must return the path
+ // to web.config in that instance.
+ string t = newSystem.GetType ().ToString ();
+ if (String.Compare (t, "System.Web.Configuration.HttpConfigurationSystem", StringComparison.OrdinalIgnoreCase) == 0)
+ systemWebInUse = true;
+ else
+ systemWebInUse = false;
+
IInternalConfigSystem old = configSystem;
configSystem = newSystem;
return old;