Personal summary point of the site development of the main points

Source: Internet
Author: User
Keywords Points

The intermediary transaction SEO diagnoses Taobao guest stationmaster buys the Cloud host technology Hall

1. When displaying the data you want to select, you must first ask whether the data is massive. For example: Select the Drop-down box and add 100 records. Your users don't scold you.

2. Try not to limit user input.

Validate input (regular expression)

Segmentation and processing of items returned as empty (String.Split (New string[]{', '; '},stringsplitoptions.removeemptyentries))

Consider Chinese, full-width character content.

3. Background interface design in advance to set a good CSS, the general background interface Development is completed, the interface changes are not very large, the processing of CSS on the line. Otherwise, a TD will change you.

4. The site Directory of the unified planning. For example, backstage management is placed in the admin directory. This facilitates a limited access to individual directories, and can also limit which directories do not need to be indexed by search engines.

5. When developing BN class, we must first consider whether the function of this class can be split into more specific subclasses. Then you might want to build an abstract class and then inherit it. However, most of the time, we don't think about it, so when you have more and more methods in one class, you should consider whether it is necessary to divide the class. .

For example: We have a logic class that deals with cars, in the beginning, no problem, but later, a lot of cars, you have to judge in many cases what kind of car, and then according to this type of car to call the corresponding method to deal with. We'll split this class up. The abstract class of a new car ( If they have many repetitive logic implementations, consider building another car interface, and then build the implementation classes for each type of car that inherits the abstract classes and interfaces above. Process the corresponding logic in each type of implementation class.

6. Pass parameters only to bn layer (do not construct SQL statement parameters, which should be constructed in the filter class of the corresponding table in the BN layer or the data layer).

7. When constructing SQL statements based on the content entered by the user, it is important to use the method of passing parameters so that the SQL injection attack can be effectively cloned. It is to construct the SQL statement with each parameter, such as Id= @id, and then use SqlParameter to generate the parameters to pass.

8. Disable page ViewState, page controls use HTML-supplied controls when there are likely to be large access pages or when there is a speed requirement on the page.

9. Do not use Net2.0 new callback function, to Ajax directly write JavaScript use XMLHTTP. There is more code on the Web.

10. When the query data is returned, do not use dataset classes, which are too dependent on the structure of the database. To convert data to the corresponding DT and DV classes (DT and DV classes) in the information layer, you can effectively prevent run-time problems caused by typing errors, and can prompt for errors at compile time. and stored in the IList object to return.

11. Outside the background of unrestricted access to the page link parameters should be clearly clear, user-friendly construction and search engine included

12. When you find that a different page contains the same part, you immediately think of splitting, creating a new user-defined control.

The event binding code for the 13.asp.net control requires the best definition in the Post code page.

14. Specifying a data source for datasource should be handled in the DataBinding event of the control.

15. When passing parameters between pages, if the middle is conducive to JavaScript function processing, the use of JavaScript code passed in Chinese is likely to produce garbled problems. You can use the following JS code to handle.

function EncodeUtf8 (S1)


{


var s = Escape (S1);


var sa = s.split ("%");


var Retv = "";


if (sa[0]!= "")


      {


Retv = sa[0];


      }


for (var i = 1; i < sa.length i + +)


      {


if (sa.substring (0,1) = = "U")


           {


Retv + + Hex2utf8 (Str2hex (sa.substring (1,5)));


           }


else Retv + = "%" + sa;


      }


    


return Retv;


}


function Str2hex (s)


{


var c = "";


var N;


var ss = "0123456789ABCDEF";


var digs = "";


for (var i = 0; i < s.length i + +)


      {


C = S.charat (i);


n = ss.indexof (c);


digs + = Dec2dig (eval (n));


      }


//return value;


return digs;


}


function Dec2dig (n1)


  {


var s = "";


var n2 = 0;


for (var i = 0; i < 4; i++)


      {


N2 = Math.pow (2,3-i);


if (N1 >= n2)


         {


s + + ' 1 ';


n1 = n1-n2;


          }


Else


s + + ' 0 ';


      }


return s;


}


function Dig2dec (s)


{


var retv = 0;


if (s.length = 4)


      {


for (var i = 0; i < 4; i + +)


          {


Retv + = eval (S.charat (i)) * MATH.POW (2, 3-i);


}


return Retv;


      }


return-1;


}


function Hex2utf8 (s)


{


var RetS = "";


var TempS = "";


var ss = "";


if (s.length = 16)


     {


TempS = "1110" + s.substring (0, 4);


TempS + + s.substring (4, 10);


TempS + + s.substring (10,16);


var sss = "0123456789ABCDEF";


for (var i = 0; i < 3; i + +)


         {


RetS + = "%";


ss = temps.substring (I * 8, (eval (i) +1) *8);


RetS + = Sss.charat (Dig2dec (ss.substring (0,4)));


RetS + = Sss.charat (Dig2dec (ss.substring (4,8)));


         }


return RetS;


     }


return "";


}

16. Search results are sorted by different proportions for different fields. For example: The weekly and monthly statistics two fields are sorted by 0.4 and 0.6 respectively. Select Weekcount,monthcount from TableName ordered by ( weekcount*0.4 + monthcount*0.6)

17. For each record that displays the results list, click or browse statistics, it is recommended to click to jump to a common page for statistics, and then in accordance with the needs of processing.

18. Do not use and useless code Delete as soon as possible

19. Comments on classes and methods are best used in///ways that are easy for other developers to use.

20. Do not use the acquired data processing as a specially constructed string format and serve as a return value or parameter, which restricts the content of the data. For example: "Data; This string format causes the data content to not contain semicolons.

21. Background page data is not necessary to save in the session, and put it in the ViewState. Data is automatically cleared after leaving the page. Session not.

The construction of 22.SQL statements, especially the special handling of query conditions, should be handled in the filter class of the corresponding table in the data layer. Easy to maintain later.

The DV class at the 23.Data layer is used to return an extension of the data structure, such as a multiple-table query, in which you can add data properties that save other table fields that you return. You can also create a new property to hold the data object of the owning child table. facilitates the processing of data structures such as parent-child tables. ParentclassDV.getChildclassDV.fieldData

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.