Web pages (single-page model)

Source: Internet
Author: User

. NET is a set of frameworks for HTML, JS, CSS, and server-side scripting to build Web pages and websites.

There are three development modes: Web pages (single-page model), MVC (Model View Controller), Web Forms (event-driven model)

Introduction to Web Forms

1. The simplest model of ASP.

2, similar to PHP and ASP

3. Built-in templates and helpers for databases, videos, social media, and more.

MVC

MVC divides a Web application into three different components:

1, the model for the data

2. View for Reality

3, for the input controller

Web Forms

1. The traditional ASP. NET event-driven development model.

2. Added Web pages for server controls, server events, and server code.

==========================================

    1. Web Pages (using Razor syntax)
    2. MVC (Model View Controller)
    3. Web Forms (Legacy ASP. NET)
What is Razor?
    1. Razor is a markup syntax for adding server-based code to a Web page
    2. Razor has the capability of traditional ASP., but is easier to learn and easier to use
    3. Razor is a server-side markup syntax similar to ASP and PHP
    4. Razor support for C # and Visual Basic programming languages
C # 's main Razor syntax rules
    1. Razor code block surrounded by @{...}
    2. In-line expressions (variables and functions) start at @
    3. The code statement ends with a semicolon
    4. Variables are declared by var keyword
    5. Strings are surrounded by references.
    6. C # code is case sensitive
    7. C # files have the. cshtml extension.

============================================

Example code:

<! DOCTYPE html>The whole work of the Ps:razor code is to detect the current time on the server and then display it.

================================================================
<!--single-line code block-->@{var mymessage = "Hello World";}  <!--multiple lines of code block-->@{var greeting = "Welcome to our site!"; var WeekDay = Datetime.now.dayofweek;var GreetingMessage = greeting + "Today is:" + WeekDay;} <p>the greeting is: @greetingMessage </p>

Web pages (single-page model)

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.