Master Page
A Master Page enables you to store the same content among multiple content pages in a website. You can use Master Page to create a common page layout. Master Pages allow you to create definitive styles for your web pages, and they have a higher precedence than CSS Stylesheets.
For example, if you want all the pages in your website to share a three-column layout, you can create once in a Master Page and apply the layout to multiple content pages.
You also can use Master Pages to display common content in multiple pages. If you want to display a standard header and footer in each page in your website, then you can create the standard header and footer in a Master Page.
Note the @ Master instead of the usual @ Page declaration.
<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
Note the @Page declaration on web.aspx is:
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>
On this page declaration, we don’t have a MasterPageFile.
We can add masterpagefile into web.aspx page, so we can using template into many page .aspx.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="web.aspx.cs"
Inherits="web" MasterPageFile="~/MasterPage.master" %>
After we declare page declaration, we must delete content like HTML,HEAD,BODY, FORM, etc. We don’t need that tag because we have used MasterPage.Master.
Now, we try to make a MasterPage.Master. Right click on Explorer – Add New Item – Choose MasterPage and Visual C#. After we add that, we design MasterPage.master as we like. We can divide the web page into 3 rows, such as: header, content, and footer.
We can add image, logo, or Text about our web into Header Page. On the footer page we declare information about year production of website, etc.
We can declare Content PlaceHolder Control from toolbox into content page. On this part, we can modify the page to your liking (color, table, font, etc).
Let's we begin to make a simple website using mastepage.
Put this code into MasterPage.Master.

After we make MasterPage.Master, we create two pages (login, and registration page).
Login Page

Registration Page

The output of our code is:


Explain: we declare header and footer in master page because of that we can use the same template in any page. Like on login.aspx and registration.aspx page. They have the same template, but the different content.
References
Include all the useful links or references that can help users learn about your tutorial
- Search Engine
- ASP.NET Resources
- code project
Download Source Code