ASP.NET master pages provide a simple way to maintain consistency when developing web sites.
This tutorial takes you through the process of building a masterpage (template) based website
Creating the master page
Identify a pre-existing HTML website for which you have the source code. If you do not have such a site, download the SimpleHTMLSite.zip and unzip it.
The next stage is to identify how many sections of the website differ from page to page. It may be as simple as the page title and some content between the menu and footer, or there may be multiple different elements
From one of the pages (in the root of the site), remove all of the unique sections of content from that page. Replace each block of content with a comment indicating what has been removed, e.g.
<!-- Contained the primary h1 element for the page-->
You should be left with a page which contains the elements common to every page on the site. (If you started with a website that was built using a template, this step may have been very easy.)
In an empty ASP.NET Web Application project (with references for Web forms added), right click on the project name and add a new item. Choose 'Web Forms Master Page' from the list, and name is something like Site.master
Within the newly created file, you will see some code is already in place. In particular, pay attention to the two ContentPlaceHolder elements shown below
These content placeholders are essentially markers which identify where unique content on each page will be located. The placeholder in the head section is already semi-appropriately named, but for clarity, change the head's content placeholder ID to headContentPlaceholder
If you only have one unique visible section (evidenced by the comments you created earlier) in the body of your HTML page, change the existing content placeholder's ID to mainContentPlaceholder. If you have multiple unique sections then you will need to add more content placeholders from the toolbox and name them appropriately. It is much easier to create all the content placeholders that you will need at this stage, than to add them later (i.e. after you have started to create child pages)
Copy and paste the relevant elements from the stripped-back page you edited earlier, ensuring that there is a content placeholder at each part of the file you previously removed content from.
As we will now be using ASP.NET, rename the file extensions in the site's menu to end in .aspx, and for the home page (likely to have an existing name of index.html or similar), ensure it is named default.aspx
Creating a web form based on a master page
Right click on the project and choose 'Add -> New item', and from the list select "Web Form with Master Page". Name the page appropriately based on the page you are reproducing from the original site.
You will be prompted to select a master page, so select the master page you previous created
Any content placed in between the opening and closing <asp:Content> tags will be inserted into the relevant content placeholders in the master page to form a complete page.
Using your original site, add the content that you previously deleted into the appropriate content area.
The only thing that is not quite the same is setting the page title - this can be set in the page declaration of the web form in the quotation marks at Page Title="" in the first line of the page. ASP.NET will insert this title into the document's <title> element.
Using the same process, create the remaining pages for the site.