Root master page and chikd project

B

Byka

have a master page on my root project.
I would like to reuse the same master page on my child project. However when
I am setting the master page file in my child project it doesn't see that
page because it is adding a name space from my child project.
Below is what I have:
RootProject
/UserControls
RootMasterPage.Master
/ChildProject
childProjectWebPage.aspx with page directive to
MasterPageFile="~/UserControls/RootMasterPage.Master"
When I run my project it is looking for
childProjectWebPage/UserControls/RootMasterPage.Master and it can find that
master page.
Can you help me
 
M

Mohamad Elarabi

Is ChildProject an actual VS Project? or is it just a folder under the
RootProject? The ~ actually reverts back to the application root. If you set
up ChildProject as a separate Project it will behave as a separate
Application no matter what folder you place it into, and no matter what
solution you place it into.

If that is the case you can try using relative paths to reference the
masterpage file in this case that would be

MasterPageFile="../UserControls/RootMasterPage.Master"

See if that works for you.

What I do in similar Scenarios is I usually have one Project, and on the
root folder I place a Root.Master and if I have subsites or mini apps under
that application they would be in their own folder. In each subsite folder
I'll have a subsite masterpage for example subsite1.master which inherits
from the root.master.

This gives you the flexibility of configuring your entire site to inherit
the basic look from the main root.master but through the subsite.master files
and in the same time you can use the subsite master files to make every
subsite look different.

Hope that helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top