2009-09-29 Gonzalo Paniagua Javier <gonzalo@novell.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Tue, 29 Sep 2009 05:41:24 +0000 (05:41 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Tue, 29 Sep 2009 05:41:24 +0000 (05:41 -0000)
* HttpContext.cs: try to load App_GlobalResouces.dll if it has not
been set but it exists in 'bin'.

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

mcs/class/System.Web/System.Web/ChangeLog
mcs/class/System.Web/System.Web/HttpContext.cs

index 4e10f2ff3211b65dd37c0b0600b33f056ece8f71..01e1ec7aba6cf486b2ccbf7e5935c3991c6a4bdd 100644 (file)
@@ -1,3 +1,8 @@
+2009-09-29 Gonzalo Paniagua Javier <gonzalo@novell.com>
+
+       * HttpContext.cs: try to load App_GlobalResouces.dll if it has not
+       been set but it exists in 'bin'.
+
 2009-09-28  Marek Habersack  <mhabersack@novell.com>
 
        * HttpContext.cs: GetResourceProvider - renamed the 'key' argument
index 5c9c093805a8c13c3f569bf7171ffd003f4a6302..6c6d9f2e8cdeae5275be8d863909fa7298317edb 100644 (file)
@@ -55,6 +55,8 @@ namespace System.Web {
        // CAS - no InheritanceDemand here as the class is sealed
        [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed partial class HttpContext : IServiceProvider {
+               static bool tried_load_global_resx;
+               static Assembly global_resources;
                internal HttpWorkerRequest WorkerRequest;
                HttpApplication app_instance;
                HttpRequest request;
@@ -92,7 +94,20 @@ namespace System.Web {
                        set { AppDomain.CurrentDomain.SetData (app_global_res_key, value); }
                }
 #else
-               internal static Assembly AppGlobalResourcesAssembly;
+               internal static Assembly AppGlobalResourcesAssembly {
+                       get {
+                               if (!tried_load_global_resx && global_resources == null) {
+                                       string file = Path.Combine (HttpApplication.BinDirectory, "App_GlobalResources.dll");
+                                       try {
+                                               global_resources = Assembly.LoadFrom (file);
+                                       } catch {
+                                       }
+                                       tried_load_global_resx = true;
+                               }
+                               return global_resources;
+                       }
+                       set { global_resources = value; }
+               }
 #endif
                ProfileBase profile = null;
                LinkedList<IHttpHandler> handlers;