using System.IO;
using System.Web;
using System.Web.Compilation;
-using System.Web.Util;\r
+using System.Web.Util;
using System.Web.J2EE;
namespace System.Web.UI
}
public static MasterPage GetCompiledMasterInstance (string virtualPath, string inputFile, HttpContext context)
- {\r
- string resolvedUrl = System.Web.Util.UrlUtils.ResolveVirtualPathFromAppAbsolute (virtualPath);\r
- Type tmpType = PageMapper.GetObjectType (resolvedUrl);\r
- if (tmpType == null)\r
+ {
+ 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");
-\r
- Object obj = Activator.CreateInstance (tmpType);\r
+
+ Object obj = Activator.CreateInstance (tmpType);
return (MasterPage) obj;
}