I.T. Discussion Community!
-Collapse +Expand
ASP Classic
Search ASP Classic Group:

Advanced
-Collapse +Expand ASP Classic Store

Prestwood eMagazine

October Edition
Subscribe now! It's Free!
Enter your email:

   ► KBASP Classic Knowledge Base  Print This    Tips Database All Groups  

ASP Classic Tips Page

These Tips are contributed by you (our online community members). They are organized by our knowledge base topics. Specifically, by the ASP Classic sub-topics.

Contribute a Tip

4 ASP Classic Coding Tips

Group: ASP Classic Coding


Topic: ASP Classic

1. ASP Constant Naming Convention
When naming constants, Microsoft suggests you prefix each constant with "con" as in conYourConstant. Although, they also say the older all caps with words separated by an underscore is still acceptable (i.e. YOUR_CONSTANT).




Topic: Language Basics

2. If Statement: No Short Circuit

Short-circuit evaluation is a feature of most languages where once an evaluation evaluates to False, the compiler evaluates the whole expression to False, exits and moves on to the next code execution line. The ASP Classic if statement does not support short-circuit evaluation but you can mimic it. Use either an if..else if..else if statement or nested if statements. ASP code that makes use of this technique is frequenlty clearer and easier to maintain than the short-circuit equivalent.






Topic: Language Details

3. ASP Application.Lock Method

Call Application.Lock to freeze ASP code while you set IIS application variables the Application.Unlock to unfreeze. No actions take place on the server while locked. 

Application.Lock

Application(YourAppVar) = AValue
Application.Unlock
 


4. Using Request.QueryString
Although you can use the generic request collection, as in Request("SomeValue"), for either Request.Form("SomeValue") or Request.QueryString("SomeValue"), it's best to avoid the generic request collection until it's really needed. Use a For Each loop to loop through elements.


Follow PrestwoodBoards on: 


©1995-2019 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech