views:

42

answers:

1

I am developing a C# VS 2008 / SQL Server 2008 ASP.NET Web Applications project. In one of my ASPX files I am trying to reference the Master file, which is actually located in the parent website. In other words, when I open the parent website, I see this project listed. But when I open this project separately, I do not see parent website and this project is the root.

So now how do I use the Master file from the parent website? Currently, I have in my ASPX file:

<%@ Page Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeFile="EnhancedCreateUserWizard.aspx.cs"
    Inherits="Membership_EnhancedCreateUserWizard" Title="Untitled Page" %>

But this won't work because it is a virtual path and since this project is the root, I can't access the Master file virtually. Instead I want to specify physical path. How accomplish I do this?

+1  A: 

You cannot share a master page between applications this way. All paths within an asp.net app are relative.

The virtual path provider simply will not reach above the current apps root.

You will need to either write a custom virtual path provider, which is not trivial, or package the master pages in a shared assembly.

You will find guidance in this question: http://stackoverflow.com/questions/30884/what-is-the-best-way-to-share-masterpages-across-projects

Sky Sanders