How to Share Site.Master Across My Applications.

RayBakker
RayBakker used Ask the Experts™
on
How can share/re-use the Site.Master with all my applications on my workstation (IISExpress) as well as on my Test and Production servers?

I create an application with the a blank page and published it to the my test server.

How I get my other applications to use the site master of this new application as their site master. Do I create a virtual directory in each application that contains this new application?

What is the best approach?

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Chinmay PatelChief Technology Ninja
Distinguished Expert 2018

Commented:
Hi Ray,

Easier one is to use Virtual Path Provider for deployed applications and for Dev simply add Site Master as a Link from within Visual Studio.

As WebForms are a dated tech, here is a really old support article which you can refer to: https://support.microsoft.com/en-us/help/910441/how-to-use-virtual-path-providers-to-dynamically-load-and-compile-cont

Regards,
Chinmay.
RayBakkerApplication Developer Analyst

Author

Commented:
Chinmay

Thank you for the quick response. A couple of questions. First, when adding the Site Master as a link, I assume I need to create a folder of the same name that the Site Master  will be on the server and add ALL the javasript and css files as links?

Do I need to create a virtual directory in every application? I can not reference any files outside the application's folder, correct?

Thanks
Chief Technology Ninja
Distinguished Expert 2018
Commented:
Hi Ray,

1. Yes.
2. That is where VirtualPathProvider comes, it acts as an abstraction layer, if you want you can create virtual directory (which will simplify things and possibly avoid using VirtualPathProvider).

You can refer to files outside of your app, if the AppPoolIdentity has access to the path you are trying to access.

Regards,
Chinmay.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial