Code reading summary of asp.net startkit Commerce

Source: Internet
Author: User
Tags eval web services

asp.net startkit commerce simple and easy to understand.

I think it's a first time study. NET code of choice, not afraid of everyone jokes, I have read the project code 3 times complete.

So, what knowledge can we learn by reading? Take a look at my summary below:

1. The realization of multilayer structure

In my opinion, 2-layer structure: PL layer and BLL layer (no obvious DAL layer, Dal and BLL together form BLL layer). But we can learn how to call the DB process.

2. Simple use of Web services

3. Use of Web user controls

4. Knowledge of data binding

Let's look at a piece of code in the project:

<asp:hyperlink cssclass= "menuselected" id= "HyperLink2" text= "<%# DataBinder.Eval" (Container.DataItem, " CategoryName ")%> ' navigateurl= ' <%# ' productslist.aspx? Categoryid= "+ DataBinder.Eval (Container.DataItem," CategoryID ") +" &selection= "+
container.itemindex% > ' runat= ' Server/>  

Description

(1) data binding in single quotes, characters in single quotes in double quotes.

(2) Pay special attention to attributes: Container.itemindex, which generates the ID of each item, which is zero-based. Features similar to MS SQL's identity (0,1). Think about my old project. In order to show the index of each row, it is very foolish to use a temporary table in db to generate row indexes and then bind the data.

5. Form-based validation

In the Web.config file, we can see the following 2 paragraphs of code:

<authentication mode= "Forms" > <forms name= "Commerceauth" loginurl= "Login.aspx" protection= "All
" path= " /"/>
</authentication>
<location path=" orderdetails.aspx ">
<system.web>
<authorization>
<deny users= "?"/>
</authorization>
</system .web>
</location>  

Description: This prohibits unauthorized access to the user page: Orderdetails.aspx, the user is automatically led to the page login.aspx login verification

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.