Getting started with master pages and shtml instances in ASP. NET

  • 2021-07-01 07:07:35
  • OfStack

In this paper, the master page and shtml in ASP. NET are analyzed in a simple way. Share it for your reference. The specific analysis is as follows:

Master page

Create and use master pages:

1. Create a master page for Webform (MasterPage)
2. Create a form that uses a master page (ContentPage).
3. Master pages use ContentPlaceHolder to dig holes, and "forms using master pages" use Content to fill holes

Master page is the server to help us splice the page response to the browser.

However, the master page is too heavy. shtml is recommended.

shtml

ServerSideInclude (SSI) and mainstream web servers (iis, apache, etc.) are supported. High efficiency, without asp. net treatment, lightweight.

Creating and using shtml:

First create two files: head. html and foot. html, then create one test. shtml

By adding the following code in test. shtml, code reuse and file splicing are realized.


<!--#include file="head.html" - >
// Place custom code here. 
<!--#include file="foot.html"-->

I hope this article is helpful to everyone's asp.net programming.


Related articles: