Master pages, however, are not without their quirks.
Master pages help us build consistent and maintainable user interfaces.
For an introduction to master pages, see "Master Pages In ASP. To make use of master pages, we first need to understand how master pages work. NET web form using a master page, the content page (.aspx) and master page (.master) merge their content together to produce a single page.
When it comes time for the master page to do its job, the master page replaces the page’s children with itself.
The master page’s next step is to look for Content controls in the controls formerly associated with the page.
Modules are good solutions when the behavior you want to achieve is orthogonal to the page processing.
For instance, authentication, authorization, session state, and profiles are all implemented as Http Modules by the ASP. You can plug-in and remove these modules to add or discard their functionality.
A page’s Master Page File property sets the master page for the content page to use.
If we try to set this property from the Load event, we will create an exception. This exception makes sense, because we know the master page has to rearrange the page’s control hierarchy before the Init event fires.Sometimes master page behavior is surprising, and indeed the very name can be a bit misleading.In this article, we are going to examine some of the common problems developers run into when using master pages, and demonstrate some practical advice for making effective use of master pages.Here is a module to set the Master Page File property on every Page object.When the module initializes, it hooks the Pre Request Handler Execute event.(For a Visual Basic version of the code snippets in this section, see this post). This is useful if different areas of an application use different master pages.