2007-11-02 Marek Habersack <mhabersack@novell.com>
authorMarek Habersack <grendel@twistedcode.net>
Fri, 2 Nov 2007 12:27:05 +0000 (12:27 -0000)
committerMarek Habersack <grendel@twistedcode.net>
Fri, 2 Nov 2007 12:27:05 +0000 (12:27 -0000)
* HttpRuntime.cs: BinDirectory returns a full path to the actual
bin directory in the application root. If no bin directory is
found, it defaults to returning <applicationPath>/bin. Fixes bug
338116.

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

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

index 5d70269174be89a45dc9d21c9f01f587fa6f618c..157102a49452214c29f5875274017f94ae731518 100644 (file)
@@ -1,5 +1,10 @@
 2007-11-02  Marek Habersack  <mhabersack@novell.com>
 
+       * HttpRuntime.cs: BinDirectory returns a full path to the actual
+       bin directory in the application root. If no bin directory is
+       found, it defaults to returning <applicationPath>/bin. Fixes bug
+       338116.
+
        * HttpApplication.cs: introduced HTTP handler cache to save time
        on repetitive handler collection traversals. On busy sites the
        traversal of the default 26 handlers may account for thousands of
index a5b16c83be2b6f79ccc945de3d2acea461c5f06d..6dc7e48407b73310c3abe08279595434743864d4 100644 (file)
@@ -209,14 +209,31 @@ namespace System.Web {
                        }
                }
 #endregion
-               
+
+               static string _actual_bin_directory;
                public static string BinDirectory {
                        get {
-                               string dirname = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath;
+                               if (_actual_bin_directory == null) {
+                                       string[] parts = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath.Split (';');
+                                       string mypath = AppDomainAppPath;
+                                       string tmp;
+                                       
+                                       foreach (string p in parts) {
+                                               tmp = Path.Combine (mypath, p);
+                                               if (Directory.Exists (tmp)) {
+                                                       _actual_bin_directory = tmp;
+                                                       break;
+                                               }
+                                       }
+
+                                       if (_actual_bin_directory == null)
+                                               _actual_bin_directory = Path.Combine (mypath, "bin");
+                               }
+                               
                                if (SecurityManager.SecurityEnabled) {
-                                       new FileIOPermission (FileIOPermissionAccess.PathDiscovery, dirname).Demand ();
+                                       new FileIOPermission (FileIOPermissionAccess.PathDiscovery, _actual_bin_directory).Demand ();
                                }
-                               return dirname;
+                               return _actual_bin_directory;
                        }
                }