How to create master page in ASP.NET MVC

In this series of article we will learn how to create master page in ASP.NET MVC like ASP.NET web form.
If you are Dot net developer then you can easily understand what I am saying. If you are not dot net developers then don’t worry I will explain what I am saying.
Let us start with how we can create Master page (Common layout) page in ASP.NET MVC.
Step 1: Go to solution explorer ->Right click on Shared folder->Add->MVC5 Layout Page(Razor)

Step 2: Enter name of Master page/Layout page. Here I put name _MasterPage  then press OK.

After that you can see your layout page is ready with some default code.

Step 3: Now I am going to add some code which is common for my web site. You can add own common code and you can also attach common Javascript and CSS file. In next article i will describe  how you can attach your JS and CSS file in Master/Layout page in MVC.

 Now I am completed with creation of layout/Master page.
Step 4: Now times to use this master/layout page in your different views.

For this I am going to add View. If you are new in MVC then please check my article for how to add view Howto create View
Go to Solution explorer->Right click on Test folder(in your its different)->Add->View

After that you need enter view name and then select Use Layout page option then browse layout/master page.

 After browsing you can select your layout page.
After that you can see your View added with some code like below image.

 Step 5: Now I am going to call above created view from controller class. If you don’t have idea how to create controller class and call view from controller action method then you can go through this article Howto create controller

Now we are ready to see this view in browser.
Step 6: Now time to see result in browser. Now I am going to press F5.

 Download Complete Demo Click Here

Priti Kumari

I am technical blogger.I blogs at and


  1. Replies
    1. This is an amazing blog,it gives very helpful messages to us.Besides that Wisen has established as Best Dot Net Training in Chennai. or learn thru ASP.NET Online Training . Nowadays Dot Net has tons of job opportunities on various vertical industry.


  2. Given so much information in it. its very useful .perfect explanation about Dot net framework.Thanks for your valuable information. dot net training in chennai velachery | dot net training institute in velachery

  3. It is really a great work and the way in which u r sharing the knowledge is excellent.
    Thanks for helping me to understand basic concepts. As a beginner in Dot Net programming your post help me a lot.Thanks for your informative article.. dot net training and placement in chennai | best dot net training in chennai