Jelajahi Sumber

2005-12-01 Chris Toshok <[email protected]>

	* GlobalizationSection.cs (PreSerialize): add checks for Culture
	and UICulture properties.


svn path=/trunk/mcs/; revision=53810
Chris Toshok 20 tahun lalu
induk
melakukan
4ff019e795

+ 5 - 0
mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog

@@ -1,3 +1,8 @@
+2005-12-01  Chris Toshok  <[email protected]>
+
+	* GlobalizationSection.cs (PreSerialize): add checks for Culture
+	and UICulture properties.
+
 2005-12-01  Chris Toshok  <[email protected]>
 
 	* AuthorizationRule.cs (..ctor): provide default values for

+ 18 - 2
mcs/class/System.Web/System.Web.Configuration_2.0/GlobalizationSection.cs

@@ -87,10 +87,26 @@ namespace System.Web.Configuration {
 			base.PostDeserialize();
 		}
 
-		[MonoTODO]
 		protected override void PreSerialize (XmlWriter writer)
 		{
-			base.PostDeserialize();
+			base.PreSerialize(writer);
+
+			/* verify our data */
+			CultureInfo culture;
+
+			try {
+				culture = new CultureInfo.GetCultureInfo (Culture);
+			}
+			catch {
+				throw new ConfigurationErrorsException ("the <globalization> tag contains an invalid value for the 'culture' attribute");
+			}
+
+			try {
+				culture = new CultureInfo.GetCultureInfo (UICulture);
+			}
+			catch {
+				throw new ConfigurationErrorsException ("the <globalization> tag contains an invalid value for the 'uiCulture' attribute");
+			}
 		}
 
 		[ConfigurationProperty ("culture", DefaultValue = "")]