Master pages VS shtml-ASP.NET details (3), asp.net details
Is this html reuse?
Web pages look the same and different in many places.
Extract the same content from the web page to form a document.
Referencing in other web pages is a traditional way of thinking in website development.
Of course, different technologies have different forms of representation.
For example, php and asp can directly write an include statement.
What about asp.net?
In webform, a master page is proposed. Of course, the master page is not recommended in this article.
I recommend using shtml.
Master page
The MasterPage of the Webform, which uses the form of the master page.
To put it simply, the master page uses ContentPlaceHolder to dig holes,
After you create a "form using the master page" on the page, use Content to fill in.
However, for website development, the master page is too heavy.
Shtml
Shtml: ServerSideInclude (SSI) is supported by mainstream web servers (such as iis and apache. High efficiency, no need for asp.net processing, lightweight.
If you have ever played something like php asp, I have nothing to say. Because they are used in the same way.
Of course, using shtml in visual studio is a small problem. (Very simple)
1. Create
You can never think of it if you have never used it.
When adding a project in Visual Studio, you cannot find the shtml file option.
The method for creating shtml is directly called xx.shtml when creating html.
2.Use
There is nothing to say about this thing. Let's give a simple example.
For example,
In index.shtml, You Want To reference top.html and footer.html.
Add such a sentence only in index.shtml.
<! -- # Include file = "top.html" -->
Body of the index.shtml page.
<! -- # Include file = "footer.html" -->
In fact, today we are mainly talking about how to create shtml. Simply put, a picture can be clear.