Tutorial :ASP.NET Master Page in separate assembly


I have some ASP.NET Master Pages located in one assembly. I need to use these Master Pages with my WebForm pages located in other assemblies that have a reference to the first assembly. I cannot seem to figure out a way to do this.

Is there a nice way that I can do this?

If no pretty solution exists I would also like to hear about possible hacks?


Master Pages are based upon Usercontrols, therefore they cannot be shared across applications.

That said, Dan Wahlin has a way around that particular limitation listed on his blog.


Sharing Master Pages Across IIS Applications by Dan Wahlin will give you some ideas..

Also, check this excellent article by Scott Allen. You can check the last section at the end on sharing master pages.


There are no pretty solutions to this problem.

What you can do is put it into a separate web application project and pre-compile it. Then take the precompiled dlls and ILMerge them into a single dll that you can reference in your app.

The actual master page that you reference will have a class name like this: MyMasterPage_aweknk so look it up in reflector. The class that looks like "MyMasterPage" is really just the code-behind.

It's really disgusting, but it's what we've done to reuse user controls in multiple applications.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »