Masters, Masters everywhere...

One of the problems you might encounter using Master Pages in ASP.NET 2.0 is sharing them amoung a large number of sites... After trying (and failing) to refer to them from a different URL, as below:

      <%@ Page Language="VB" MasterPageFile="http://webserver/master/MasterPage2.master" AutoEventWireup="false" CodeFile="Home.aspx.vb" ...>

I discovered that it seems that the Master Pages have to be in the application's scope.

The solution, as it were, would be to copy the master pages into each web site, perhaps into a folder called masters. However, Marc Drouillard from the University Hospital Network (UHN), came up with a more elegant solution.

1) Create a new vdir in IIS called SharedMasters

2) Place all the .master files (and code-beside files, if necessary) into this directory

3) When creating a web site, map the SharedMasters into your web application using IIS. (new virtual directory)

They are now in scope and work.