importing messaging-2008 branch to trunk [continued]
[mono.git] / mcs / class / System.Web / System.Web.UI / MasterPageParser.jvm.cs
index a2edb6e2796d67e19a9a0d9087d5a7583ecbbbfc..da72d87e945d030be71086918123f8dccdcb6757 100644 (file)
@@ -36,6 +36,7 @@ using System.IO;
 using System.Web;
 using System.Web.Compilation;
 using System.Web.Util;
+using System.Web.J2EE;
 
 namespace System.Web.UI
 {
@@ -47,7 +48,19 @@ namespace System.Web.UI
                
                public static MasterPage GetCompiledMasterInstance (string virtualPath, string inputFile, HttpContext context)
                {
-                       return null;
+                       string resolvedUrl;
+                       if (VirtualPathUtility.IsAbsolute (virtualPath))
+                               resolvedUrl = virtualPath;
+                       else if (VirtualPathUtility.IsAppRelative (virtualPath))
+                               resolvedUrl = System.Web.Util.UrlUtils.ResolveVirtualPathFromAppAbsolute (virtualPath);
+                       else
+                               resolvedUrl = VirtualPathUtility.Combine (VirtualPathUtility.GetDirectory (context.Request.FilePath, false), virtualPath);
+                       Type tmpType = PageMapper.GetObjectType (context, resolvedUrl);
+                       if (tmpType == null)
+                               throw new InvalidOperationException ("Master page '" + virtualPath + "' not found");
+
+                       Object obj = Activator.CreateInstance (tmpType);
+                       return (MasterPage) obj;
                }
 
                public static Type GetCompiledMasterType (string virtualPath, string inputFile, HttpContext context)