improve support for RewritePath
authorNoam Lampert <noaml@mono-cvs.ximian.com>
Mon, 16 Jun 2008 12:21:06 +0000 (12:21 -0000)
committerNoam Lampert <noaml@mono-cvs.ximian.com>
Mon, 16 Jun 2008 12:21:06 +0000 (12:21 -0000)
svn path=/trunk/mcs/; revision=105897

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

index 2eab645c8bac8490d860e03dac659e5aa5213060..6ea5b9e53f286ed358acde630b0f2e94bfb601b9 100644 (file)
@@ -1,3 +1,7 @@
+2008-06-16  Noam Lampert  <noaml@mainsoft.com>
+
+       * HttpContext.cs: improve support for RewritePath
+
 2008-06-10  Marek Habersack  <mhabersack@novell.com>
 
        * HttpRuntime.cs: do not create a new thread to run the
index 5148d7f8d00829fa1003eb094cd45d1bdcd848c3..a6ff2de11a8ee66781c0f6ed25dc717299e67def 100644 (file)
@@ -636,7 +636,10 @@ namespace System.Web {
 #endif
                void RewritePath (string filePath, string pathInfo, string queryString, bool setClientFilePath)
                {
-                       filePath = UrlUtils.Combine (Request.BaseVirtualDir, filePath);
+                       if (UrlUtils.IsRooted (filePath))
+                               filePath = UrlUtils.Combine (Request.BaseVirtualDir, UrlUtils.Canonic (filePath).Substring (1));
+                       else
+                               filePath = UrlUtils.Combine (UrlUtils.GetDirectory (Request.FilePath), filePath);
                        if (!StrUtils.StartsWith (filePath, HttpRuntime.AppDomainAppVirtualPath))
                                throw new HttpException (404, "The virtual path '" + filePath + "' maps to another application.", filePath);