Compile other resources such as the master page or aspx to the DLL and share them in multiple ASP. NET projects.

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.