[Mono-bugs] [Bug 78796][Nor] Changed - [2.0] Master Page code file can not be found

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Feb 27 22:21:24 EST 2007


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 mmorano at mikeandwan.us.

http://bugzilla.ximian.com/show_bug.cgi?id=78796

--- shadow/78796	2007-02-19 15:39:01.000000000 -0500
+++ shadow/78796.tmp.4054	2007-02-27 22:21:24.000000000 -0500
@@ -79,6 +79,64 @@
 
 MS works w/o having to specify the app relative path to the codebehind
 for master pages.
 
 Thanks,
 Mike
+
+------- Additional Comments From mmorano at mikeandwan.us  2007-02-27 22:21 -------
+Ok, I have looked into this further, as I continue to migrate my site
+from MS to Mono, and have a working start at the solution.
+
+For this example, the application root is "/". There is a master page
+at /includes/master_pages/global.master.  global.master references
+"global.master.cs" for it's CodeFile (notice it is missing the path
+information) in the masterpage declaration.  
+
+Eventually the framework tries to lookup the location of this
+global.master.cs file (TemplateParser.ProcessMainAttributes - near
+line 514 in my version).  20 lines down it pulls out the "CodeFile"
+attribute and then tries to find the source using
+UrlUtils.Combine(BaseVirtualDir, src).  In this scenario,
+BaseVirutalDir = "~/includes/master_pages" and src = "global.master.cs".
+
+The current implementation of UrlUtils.Combine results in a value of:
+"/global.master.cs" which is incorrect.
+
+The following is a diff illustrating the change I made, and can
+validate that it works on the test provided above.  This results in
+the proper path to "/includes/master_pages/global.master.cs":
+
+Index: UrlUtils.cs
+===================================================================
+--- UrlUtils.cs (revision 73455)
++++ UrlUtils.cs (working copy)
+@@ -129,8 +129,14 @@
+                                return Canonic (basePath + slash +
+relPath);
+                        }
+ 
+-                       if (basePath == null || basePath == "" ||
+basePath [0] == '~')
++                       if (basePath == null || basePath == "")
++                       {
+                                basePath =
+HttpRuntime.AppDomainAppVirtualPath;
++                       }
++                       else if(basePath[0] == '~')
++                       {
++                               basePath =
+HttpRuntime.AppDomainAppVirtualPath + basePath.Substring(1);
++                       }
+ 
+                        if (basePath.Length <= 1)
+                                basePath = String.Empty;
+
+
+As I indicated above, this does work on my small test, and might
+expect this to fix other related issues.  I do not fully understand
+all the scenarios this method needs to cover, so please enhance code
+above accordingly.
+
+
+Thanks,
+Mike


More information about the mono-bugs mailing list