This articleArticleThe title is really not good, because the requirements are complicated:You want to compile other resources such as the master page or aspx into a dynamic link library, and then add a reference to the dynamic link library in the Web application, the internal ASPX page or master page of The dll can be used.
Take the template page as an example. The implementation method is as follows:
1. Compile the master page file as a resource into the dynamic link library.
Right-click the file and choose Properties> build action> embedded resource.
2. Implement customVirtualpathprovider, Load the master page from the dynamic link library
3. register the customVirtualpathprovider
I searched in the blog garden.VirtualpathproviderSomeone once wrote this thing, so I won't repeat it. Finally, I will linkCodeSample project and provide some material links.
In short, the basic principle is:Register a customVirtualpathproviderEvery time the Asp.net website accesses a virtual path resourceVirtualpathproviderTherefore, even if the file does not exist physically, I can load it from the database or, as in this article, from the DLL resources.
References:
Virtualizing access to content: serving your web site from a zip file
Sharing master pages amongst applications by embedding it in a DLL
Sample Code:
Http://blogs.msdn.com/shahpiyush/attachment/1847195.ashx
Virtualpathprovider discussed in the blog:
Http://www.cnblogs.com/firstyi/archive/2008/04/19/1161431.html