How to write excellent ASP applications (1)

Source: Internet
Author: User
How to create robust, accurate, maintainable, and performance-Good ASP applications? What do you want to do? Not doing what? In this paper, the main check-points (check point) is given in the form of outline.


  


What is an ASP


  


Active Server Page, abbreviated as ASP, is:


  


  . Connect user interface (HTML) and business logic (Business Logic);


  . Provide consistent, easy-to-use, stateful, web-based clients;


  . Provides an application environment for Web applications that require transactional processing.


  


ASP is not:


  


  . Where business logic is implemented (Business Logic); Business logic should be implemented through COM +, MTS, or the database.


  


ASP users should have the following lessons:


  


  . Develop applications instead of developing an orphaned ASP page;


  . Caching of inputs and outputs;


  . To test before release;


  . A component with better selectivity;


  . Reduced access to the database: The result of a cached transformation;


. Use MSMQ to handle work with time delays;


  


Site Design


  


  . What does your site want to offer?


  . Information architecture: 80/20 guidelines;


  . Site navigation;


  . page layout;


  .
of usability;

  . Use ALT and title attributes;


  . Navigation without using a picture or image map;


  . For most of the lower-version browsers, consider their support for ActiveX, RDS, XML, DHTML, Java applets;


  . Screen resolution and number of screen colors


  . Do you support WebTV, PDA ...?


  . Set the width and Height properties of the IMG.


  . Non-browser access, such as an automated Robot (Spider);


  . Use frames (frame)?


  . Personalized use of cookies;


  . Avoid bad connections;


  . Use meta tags;


  . Content audit;


  . Content search;


  . Results Feedback: User feedback and tracking;


. reduce download time;


  


three-layer, four-storey application design


  


readability, maintainability


  


  . use annotations;


  . Use <%optio in VBScript scripts. explicit%>;


  . Storing SQL strings using string variables: Easy to debug;


  . Use Server.MapPath and relative paths;


  . Use Adodb.inc or <!-metadata typelib=somelib file=somedll--> to refer to constants, and do not use constant values directly.


  . Specify the default parameters of ADO calls to avoid errors;


  . Use a library or part to encapsulate code.


  


the right way:


  


  . Using Server.URLEncode


  . Error trapping and handling


  


Internationalization:


  


  . Use <%CodePage%>


  . Using Session.CodePage


. In IIS5.0, Response.Write supports UTF8


  


Other:


  


  . Reusing code using #include


  .
with Paging technology

  


Site Security:


  


  . Client Authentication


  . Input Validation


  . Do not use #include files. Inc suffix, use. ASP or settings. Inc Application Mapping


  . Store the MDB file under a non-web path;


  . Using ADSI to do security management


  


session and Application status


  

Use of
session:


  


  . Very convenient to use but very problematic;


  . HTTP is a stateless protocol;


  . It is especially useful to design shopping carts;


  . Not conducive to scalability design (scalability);


  . Use <%EnableSessionState=false%>
in pages that do not require a session

. Avoid using session as completely as possible;


  . Not appropriate in the case of multiple Web servers;


  . Some parts allow the session to run in a single threading mode, reducing throughput;


  . Consumes memory;


  . The session has a timeout problem


  . Requires the client's browser to open cookie settings;


  . Do not save the recordset in the session, or cache the connection object;


  . Do not use empty session_onend in Global.asa;


  . Optional option:


  . Cookies


  . Direct State coding: simple, easy, unsafe


  . ID of Back-end database as status value


  . QueryString Parameter


  . Like Amazon's URL way


  . Hidden form


  


Application variable:


  


  . Shared variable


  . Cannot persist


  . Multiple Web servers are not allowed unless they are read-only variables.


  


Cache





  . Very ideal for static content


  . Do not use response.expires=0, use negative numbers:


  . response.expires=-10000;
.

  . Response.AddHeader "Pragma", "No-cache"


  . Response.AddHeader "Cache-control", "No-store"


  . Server Cache


  . Proxy Cache


  . Client Cache





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.