
It's common practice to store files that are shared among web pages in a folder named Shared. In the root folder, create a folder named Shared. Replace the existing markup with the following:

In the root folder of your website, create a file named Index.cshtml. When you're done, you'll get a page like this: You can use these same content blocks in any page in your site. In this procedure, you'll create a page that references two content blocks (a header and a footer) that are located in separate files. The finished (merged) page is then sent to the browser. When a browser requests a page from the web server, ASP.NET inserts the content blocks at the point where the RenderPage method is called in the main page. The following diagram shows how content blocks work.
#ADD A HEADER IN RESPONSIVE SITE DESIGNER UPDATE#
If you need to change the content, you can just update a single file, and the changes are then reflected everywhere the content has been inserted. Creating common content like this also makes it easier to update your site. That way you don't have to copy and paste the same content into every page. You can then insert the content block in other pages on the site where you want the information to appear. ASP.NET lets you create a separate file with a content block that can contain text, markup, and code, just like a regular web page. Many websites have content that's displayed on every page, like a header and footer, or a box that tells users that they're logged in.

This tutorial also works with ASP.NET Web Pages 2.

#ADD A HEADER IN RESPONSIVE SITE DESIGNER HOW TO#
How to pass data at run time to a layout page.How to create a consistent look for all the pages in your site using a layout.How to create reusable blocks of content like headers and footers.This article explains how you can use layout pages in an ASP.NET Web Pages (Razor) website to create reusable blocks of content (like headers and footers) and to create a consistent look for all the pages in the site.
