Master page VS shtml & mdash; ASP. NET details (3), asp.net details

Source: Internet
Author: User

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.

 


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.