Merge pull request #1896 from meum/patch-1
[mono.git] / mcs / class / System.Web / System.Web.Hosting / SimpleWorkerRequest.cs
index dc3c61107719d0b669de8da5de2e53623268091e..0b8b450ecc44e3507a67dac8e9e379fd40930c0f 100644 (file)
@@ -57,7 +57,7 @@ namespace System.Web.Hosting {
                        
                // computed
                string raw_url;
-               
+
                //
                // Constructor used when the target application domain
                // was created with ApplicationHost.CreateApplicationHost
@@ -127,11 +127,9 @@ namespace System.Web.Hosting {
                                return null;
                        }
                }
-#if NET_2_0
                public override string RootWebConfigPath {
                        get { return WebConfigurationManager.OpenWebConfiguration ("~").FilePath; }
                }
-#endif
 
                public override void EndOfRequest ()
                {
@@ -172,7 +170,7 @@ namespace System.Web.Hosting {
                        else
                                local_page = page;
                        
-                       string path = UrlUtils.Combine (app_physical_dir, local_page);
+                       string path = Path.Combine (app_physical_dir, local_page);
                        if (SecurityManager.SecurityEnabled && (path != null) && (path.Length > 0)) {
                                new FileIOPermission (FileIOPermissionAccess.PathDiscovery, path).Demand (); 
                        }
@@ -255,13 +253,17 @@ namespace System.Web.Hosting {
                {
                        if (!hosted)
                                return null;
-
+                       if (path != null && path.Length == 0)
+                               return app_physical_dir;
+                       
                        if (!path.StartsWith (app_virtual_dir))
                                throw new ArgumentNullException ("path is not rooted in the virtual directory");
 
                        string rest = path.Substring (app_virtual_dir.Length);
                        if (rest.Length > 0 && rest [0] == '/')
                                rest = rest.Substring (1);
+                       if (Path.DirectorySeparatorChar != '/') // for windows suport
+                               rest = rest.Replace ('/', Path.DirectorySeparatorChar);
                        return Path.Combine (app_physical_dir, rest);
                }