All pastes #288111 Raw Edit

Stuff

public text v1 · immutable
#288111 ·published 2006-12-22 01:06 UTC
rendered paste body
Index: System.Web.Hosting/HostingEnvironment.cs
===================================================================
--- System.Web.Hosting/HostingEnvironment.cs    (revision 69918)
+++ System.Web.Hosting/HostingEnvironment.cs    (working copy)
@@ -32,8 +32,10 @@
 #if NET_2_0
 
 using System;
+using System.Globalization;
 using System.Security.Permissions;
 using System.Threading;
+using System.Web.Configuration;
 using System.Web.Caching;
 using System.Web.Util;
 
@@ -168,16 +170,20 @@
                        vpath_provider = virtualPathProvider;
                }
                
-               [MonoTODO ("Not implemented")]
                public static IDisposable SetCultures (string virtualPath)
                {
-                       throw new NotImplementedException ();
+                       GlobalizationSection gs = WebConfigurationManager.GetSection ("system.web/globalization", virtualPath) as Globaliz
ationSection;
+                       IDisposable ret = Thread.CurrentThread.CurrentCulture as IDisposable;
+                       string culture = gs.Culture;
+                       if (String.IsNullOrEmpty (culture))
+                               return ret;
+                       Thread.CurrentThread.CurrentCulture = new CultureInfo (culture);
+                       return ret;
                }
 
-               [MonoTODO ("Not implemented")]
                public static IDisposable SetCultures ()
                {
-                       throw new NotImplementedException ();
+                       return SetCultures ("~/");
                }
 
                public static void UnregisterObject (IRegisteredObject obj)