Parcourir la source

* ConfigurationSettings.cs: Avoid chicken-egg problem when reading machine.config.
Cannot use an uri to read mechine.config because web request module handelrs are
defined in machine.config.

svn path=/trunk/mcs/; revision=15446

Lluis Sanchez il y a 22 ans
Parent
commit
338698bd27

+ 6 - 0
mcs/class/System/System.Configuration/ChangeLog

@@ -1,3 +1,9 @@
+2003-06-16  Lluis Sanchez Gual <[email protected]>
+
+	* ConfigurationSettings.cs: Avoid chicken-egg problem when reading machine.config.
+	  Cannot use an uri to read mechine.config because web request module handelrs are
+	  defined in machine.config.
+
 2003-03-02  Gonzalo Paniagua Javier <[email protected]>
 
 	* AppSettingsReader.cs: fixed bug #38755.

+ 6 - 4
mcs/class/System/System.Configuration/ConfigurationSettings.cs

@@ -157,11 +157,12 @@ namespace System.Configuration
 
 			try {
 				try {
-					reader = new XmlTextReader (fileName);
-				} catch {
+					FileStream fs = new FileStream (fileName, FileMode.Open, FileAccess.Read);
+					reader = new XmlTextReader (fs);
+				} catch (Exception ex) {
 					return false;
 				}
-				
+
 				InitRead (reader);
 				ReadConfigFile (reader);
 			} finally {
@@ -207,7 +208,8 @@ namespace System.Configuration
 		{
 			XmlTextReader reader = null;
 			try {
-				reader = new XmlTextReader (fileName);
+				FileStream fs = new FileStream (fileName, FileMode.Open, FileAccess.Read);
+				reader = new XmlTextReader (fs);
 			} catch {
 				return null;
 			}