Sharing Master Pages and Themes across applications
Themes:
Using Global Theme is way to share Theme between different Apps.eg if you want to create a Global Theme called theme1
-
For Cassini server create a Theme1 folder inside framework folder like \WINDOWS\Microsoft.NET\Framework\v2.0.xxxxx\
-
For IIS server create a Theme1 folder inside like \Inetpub\wwwroot\aspnet_client\system_web\
Application level Themes will override Global themes. so if Theme named ThemeName is defined at Global and Application level then application level Blue theme will be applied to the site.
Master Pages:
* Image and Content based on David Christiansen's Weblog
The process:
-
Create an empty Website in VS.NET 2005 (delete anything in it including App_Data and Default.aspx).
-
Add a master page into the Website.
-
Select Build | Publish Website from the VS.NET menu.
-
On the screen that follows select a target site, and check all of the checkboxes except for the top one that allows for dynamic updates. ( Note you need to supply your own sink file. You can do so with the Strong Name Tool
-
Something like this:

-
After the publish operation completes, You should see a new assembly (with a somewhat strange name) in the Bin folder. This assembly is your master page in compiled form.
-
Install the assembly into the GAC using gacutil.exe or drag-and-drop it into c:\Windows\Assembly
-
Add a web.config file into your project and add the following within the <system.web> begin and end tags, You'll need to change the name of the assembly to the name that is generated for your project (the one you added into the GAC) and change the PublicKeyToken to the one you see in the GAC.
1: <compilation debug="true">
2: <assemblies>
3: <add assembly"App_Web_masterpagebase.master.cdcab7d2, Version=0.0.0.0, 4: Culture=neutral,PublicKeyToken=cceb8435cfc68486" /> // THIS MUST BE ONE LINE
5: </assemblies>
6: </compilation>
-
Add a master page into the Website but don't create a code-behind page for it, instead change the header of the master to read like this
-
1: <%@ Master Language="C#" Inherits="ASP.masterpagebase_master" %>
-
and delete all the rest of the content from the master page.
-
You can use the object browser to see the name of your class that is within the .dll generated it should be within an ASP namespace.