Skip to content

Instantly share code, notes, and snippets.

@grendello
Created March 21, 2011 23:07
Show Gist options
  • Save grendello/880430 to your computer and use it in GitHub Desktop.
Save grendello/880430 to your computer and use it in GitHub Desktop.
diff --git a/mcs/class/System.Web/System.Web.UI/MasterPage.cs b/mcs/class/System.Web/System.Web.UI/MasterPage.cs
index f3327f9..304d12d 100644
--- a/mcs/class/System.Web/System.Web.UI/MasterPage.cs
+++ b/mcs/class/System.Web/System.Web.UI/MasterPage.cs
@@ -33,6 +33,7 @@ using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Web.Compilation;
+using System.Web.Hosting;
using System.Web.Util;
using System.Web.UI.WebControls;
using System.IO;
@@ -111,6 +112,9 @@ namespace System.Web.UI
internal static MasterPage CreateMasterPage (TemplateControl owner, HttpContext context,
string masterPageFile, IDictionary contentTemplateCollection)
{
+ var req = context.Request;
+ if (req != null)
+ masterPageFile = HostingEnvironment.VirtualPathProvider.CombineVirtualPaths (req.CurrentExecutionFilePath, masterPageFile);
#if TARGET_JVM
MasterPage masterPage = MasterPageParser.GetCompiledMasterInstance (masterPageFile,
owner.Page.MapPath (masterPageFile),
diff --git a/mcs/class/System.Web/System.Web.UI/MasterPageParser.cs b/mcs/class/System.Web/System.Web.UI/MasterPageParser.cs
index 72e883b..6558fb6 100644
--- a/mcs/class/System.Web/System.Web.UI/MasterPageParser.cs
+++ b/mcs/class/System.Web/System.Web.UI/MasterPageParser.cs
@@ -103,9 +103,11 @@ namespace System.Web.UI
} else {
string path = GetString (atts, "VirtualPath", null);
if (!String.IsNullOrEmpty (path)) {
- if (!HostingEnvironment.VirtualPathProvider.FileExists (path))
+ var vpp = HostingEnvironment.VirtualPathProvider;
+ if (!vpp.FileExists (path))
ThrowParseFileNotFound (path);
-
+
+ path = vpp.CombineVirtualPaths (VirtualPath.Absolute, VirtualPathUtility.ToAbsolute (path));
masterTypeVirtualPath = path;
AddDependency (path);
} else
diff --git a/mcs/class/System.Web/System.Web.UI/PageParser.cs b/mcs/class/System.Web/System.Web.UI/PageParser.cs
index 82769d3..4e61c51 100644
--- a/mcs/class/System.Web/System.Web.UI/PageParser.cs
+++ b/mcs/class/System.Web/System.Web.UI/PageParser.cs
@@ -405,8 +405,10 @@ namespace System.Web.UI
if (!String.IsNullOrEmpty (value)) {
if (!BaseParser.IsExpression (value)) {
value = System.Web.VirtualPathUtility.Combine(BaseVirtualDir, value);
- if (!HostingEnvironment.VirtualPathProvider.FileExists (value))
+ var vpp = HostingEnvironment.VirtualPathProvider;
+ if (!vpp.FileExists (value))
ThrowParseFileNotFound (value);
+ value = vpp.CombineVirtualPaths (VirtualPath.Absolute, VirtualPathUtility.ToAbsolute (value));
AddDependency (value);
masterPage = new MainDirectiveAttribute <string> (value, true);
} else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment