using System.Web;
using System.Web.Compilation;
using System.Web.Util;
+using System.Web.J2EE;
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)