.NET PETSHOP Detailed (4): PETSHOP three-layer structure PresentationTier

xiaoxiao2021-03-17  182

In the previous article, we have made a description of the .NET PETSHOP data layer and the intermediate business logic layer, and in the next article, we will explore the data display layer. There is a lot of difference with the two layers of the front, and the display layer of .NET PETSHOP has used many Microsoft's latest web forms technology, ready, ASP.NET. Therefore, before explaining the display layer, I want to make some instructions on the very important feature used by ASP.NET in the development of .Net PETSHOP, in order to distinguish:

(1) ASP.NET code is no longer an interpreted code, and can be operated after compiling through the JIT compiler, and a good page buffer mechanism can be introduced.

(2) The configuration model of ASP.NET introduces a "zero installation" configuration model based on XML file. The meaning of zero installation is just to copy the configuration file web.config, the application is copied to the system specified by the system, and the file is changed and saved directly in the file.

(3) Safety management ASP.NET provides more powerful and reliable security than traditional ASPs. ASP.NET provides three verification methods and two types of authorization services.

(4) Support code and page content separation. Recall the problem when writing ASP programs before: The code logic is confusing, it is difficult to manage.

(5) Provides better state management, including management of the session state and management of view status.

(6) A large number of ASP.NET server-side controls and support for the development of user controls.

.NET PETSHOP fully uses server control technology and session status management. The interaction interface of the display layer uses the ASPX page, and the rear end has separate logic code. .NET PETSHOP has 19 ASPX pages and code logic. Listed here and describe setting parameters and its role.

ASP.NET web page

EnablesessionState

EnableViewState

instruction manual

Cart.aspx

True

True

shopping list

Category.aspx

True

False

Product classification list

Checkout.aspx

Readonly

False

Order Confirmation

CreateNewaccount.aspx

False

True

Create a new account

DEFAULT.ASPX

False

False

System Home

Editaccount.aspx

False

True

Account editing

Error.aspx

False

False

Error handling

Help.aspx

False

False

help

OrderaddressConfirm.aspx

Readonly

False

Order address confirmation

OrderBilling.aspx

True

True

order information

ORDERPROCESS.ASPX

Readonly

False

place an order

ORDERSHIPPING.ASPX

True

True

Order address and name

Product.aspx

False

False

Product List

ProductDetails.aspx

False

False

product detailed information

Search.aspx

False

False

search for

Signin.aspx

False

False

Account login

Signout.aspx

True

False

Account exit

ValidateAccount.aspx

False

False

Account creation confirmation

VerifySIGN.ASPX

False

False

Account login confirmation

.NET PETSHOP uses many user controls, which are located below the web / incap. Table 2 makes an explanation for user controls:

User Controls

EnableViewState

instruction manual

Controladdress

True

Detailed address list

Controlbanner

False

Banner at the bottom of the page

Controlcart

True Shopping List

Controlfavlist

False

Personal Favorites list

ControlHeader

False

Menu and links at the top of the page

ControlStaticAddress

False

Address information that cannot be edited

A piece of code is listed below, indicating the settings of these parameters, and references for user controls:

/ * Excerpt from Cart.aspx * /

<% @ Register tagprefix = "petshop" tagname = "Cart" src = "inc / controlcart.ascx"%>

<% @ Register tagprefix = "petshop" tagname = "header" src = "inc / controlheader.ascx"%>

<% @ Page language = "c #" codebehind = "checkout.aspx.cs" autoeventwireup = "false" inherits = "petshop.web.checkout" enablesationState = "readonly" enableViewState = "false"%>

The two REGISTE instructions are used to reference the user controls for ControlCart and ControlHead, and the Page directives define the page specific properties used by the ASP.NET Page Analyzer and the compiler.

Use the code below to display the control in the emission location of the control:

In the above code, the Allowedit is transmitted to the instantiated CTLCART parameters. I personally think that the user control is a good thing, which can simplify the development model of the web page to reach the code multiplex, and its development is very simple, and the development of ASPX is basically the same.

Next article We will further illustrate system configuration and security management.

转载请注明原文地址:https://www.9cbs.com/read-129614.html

New Post(0)