[Mono-bugs] [Bug 79280][Nor] Changed - [2.0] MapPath: Mapping across applications not allowed

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Sep 5 05:27:12 EDT 2006

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by grendello at gmail.com.


--- shadow/79280	2006-09-04 18:40:02.000000000 -0400
+++ shadow/79280.tmp.6488	2006-09-05 05:27:12.000000000 -0400
@@ -1,14 +1,14 @@
 Bug#: 79280
 Product: Mono: Class Libraries
 Version: 1.1
+OS: unknown
 OS Details: 
 Status: NEW   
+Severity: Unknown
 Priority: Normal
 Component: Sys.Web
 AssignedTo: gonzalo at ximian.com                            
 ReportedBy: grendello at gmail.com               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
@@ -32,6 +32,63 @@
 but then another exception is thrown further down the code by InternalInvoke.
 ------- Additional Comments From grendello at gmail.com  2006-09-04 18:40 -------
 Created an attachment (id=17608)
+------- Additional Comments From grendello at gmail.com  2006-09-05 05:27 -------
+After spending some more time looking at the code, there seem to be
+two factors contributing to the bug:
+1. RootVirtualDir (in HttpRequest.cs) used by MapPath
+It takes the FilePath and removes the file name from it, treating the
+result as the virtual application root - which is not true most of the
+time, since the virtual root would be the virtual path corresponding
+to the directory with the bin/ subdir (to simplify matters). Thus the
+path string compare in MapPath throws an exception for situation when
+TemplateParser takes the path to the master file code behind from the
+and the request is for an ASPX file in a subdir of the site (say,
+/sub/default.aspx) which refers to the master like so:
+The comparison in MapPath then, looks like so (after a call from
+virtualPath == /sitemaster.master.cs
+RootVirtualDir == /sub/
+which cannot succeed and yet it is definitely not a cross-app call
+2. TemplateParser should treat CodeFile and MasterPageFile as
+potentially relative paths which it does not. It should, prior to
+passing the master page code behind file to MapPath, attribute it with
+the current virtual path. If this is satisfied (I tested it), then the
+cross-app mapping exception is not thrown.
+However, "fixing" the above leads to another problem, shown below:
+Server error in '/' application
+Description: Error processing request.
+Error Message: HTTP 500.
+Stack Trace:
+System.Reflection.TargetException: Unable to invoke an invalid target.
+  at <0x00000> <unknown method>
+  at (wrapper managed-to-native)
+System.Reflection.MonoMethod:InternalInvoke (object,object[])
+  at System.Reflection.MonoMethod.Invoke (System.Object obj,
+BindingFlags invokeAttr, System.Reflection.Binder binder,
+System.Object[] parameters, System.Globalization.CultureInfo culture)
+[0x00056] in
+I'm trying to find out who is the callee in the above situation (it's
+coming probably from TemplateParser)

More information about the mono-bugs mailing list