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

Advanced
-Collapse +Expand ASP Classic Store

Prestwood eMagazine

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

   ► KBASP Classic Knowledge Base  Print This    All Groups  

ASP Classic Coding Tech Articles

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

Contribute an Article

34 ASP Classic Coding Articles

Group: ASP Classic Coding


Topic: ASP Classic

Setting ADO objects to Nothing without first closing them might cause ASPMail to fail
Posted By Kim Berry, Post #100079, KB Topic: ASP Classic
  +Add Comment

ASP and ADO coding best practices.
Posted By Mike Prestwood, Post #100144, KB Topic: ASP Classic
  +Add Comment

Arrays in ASP Classic use a 0-based indice.

Use UBound to get the number of elements. UBound returns -1 if the array has no elements, 0 if it has 1, 1 if it has 2, etc.

Posted By Mike Prestwood, Post #102133, KB Topic: ASP Classic
  +Add Comment

In ASP Classic, you have to add an empty string to the value being compared in order to get consistent results. For example, add &"" to your string varilable or it's code equivalent &vbNullString. Then compare to an empty string or verify it's length to 0 with Len.

Posted By Mike Prestwood, Post #102039, KB Topic: ASP Classic
  +Add Comment  (4 Comments)

Developer blog journal for our ASPSuite product. This blog is intended for the Prestwood ASP Classic developers.
Posted By Mike Prestwood, Post #100399, KB Topic: ASP Classic
  +Add Comment  (16 Comments)

Using CDO to send email.
Posted By Mike Prestwood, Post #100248, KB Topic: ASP Classic
  +Add Comment

Introduction to the global.asa file.
Posted By Mike Prestwood, Post #100169, KB Topic: ASP Classic
  +Add Comment  (1 Comments)

A quick comparison.

Posted By Adam Lum, Post #100665, KB Topic: ASP Classic
  +Add Comment  (1 Comments)

Use IsEmpty or Len > 0 to test
When clearing, set to Null (not "")
Posted By Mike Prestwood, Post #100229, KB Topic: ASP Classic
  +Add Comment  (1 Comments)

Running ASP on IIS
Posted By Adam Lum, Post #100300, KB Topic: ASP Classic
  +Add Comment




Topic: Tool Basics

An example of using ASP's Response.Write and creating functions.

Posted By Mike Prestwood, Post #100014, KB Topic: Tool Basics
  +Add Comment

Save as VB Classic.

Posted By Mike Prestwood, Post #101585, KB Topic: Tool Basics
  +Add Comment  (6 Comments)

Create a basic Class in ASP
Posted By Adam Lum, Post #100304, KB Topic: Tool Basics
  +Add Comment  (2 Comments)




Topic: Language Basics

The End If is optional if you put your code on a single line.

Posted By Mike Prestwood, Post #101383, KB Topic: Language Basics
  +Add Comment  (5 Comments)

Same as VB. ASP Classic logical operators:

and and, as in this and that
or or, as in this or that
Not Not, as in Not This

Posted By Mike Prestwood, Post #101891, KB Topic: Language Basics
  +Add Comment  (4 Comments)

In ASP, you can buffer a RecordSet in either a session or application variable. This code snippet shows you how to create a reusable method for buffering RecordSets in an application variable.
Posted By Mike Prestwood, Post #100410, KB Topic: Language Basics
  +Add Comment

Use Application.Contents.RemoveAll and Session.Contents.RemoveAll

Posted By Mike Prestwood, Post #100452, KB Topic: Language Basics
  +Add Comment  (1 Comments)

Many users these days have very wide screens. This article shows you how to determine the browser width using ASP classic.
Posted By Mike Prestwood, Post #101299, KB Topic: Language Basics
  +Add Comment

Code sample to get a count of the number of fields in a table of a particular field type (a particular DataTypeEnum).
Posted By Mike Prestwood, Post #100432, KB Topic: Language Basics
  +Add Comment

You can use JavaScript to set an IIS App var to the GMT server difference. Then use that number in your code.
Posted By Mike Prestwood, Post #100536, KB Topic: Language Basics
  +Add Comment  (2 Comments)

This code snippet shows you how to loop through a form's fields.
Posted By Mike Prestwood, Post #100422, KB Topic: Language Basics
  +Add Comment  (2 Comments)

Call randomize then call Rnd to generate a random number between 0 and 1.
Posted By Mike Prestwood, Post #100691, KB Topic: Language Basics
  +Add Comment

The Scripting object provides reading and writing of files. By adding a string replace in each line, ASP content can reside in a DB and inserted into the desired template.
Posted By Kim Berry, Post #100020, KB Topic: Language Basics
  +Add Comment

How to use ASPMail to send email from your web site.

Posted By Mike Prestwood, Post #100216, KB Topic: Language Basics
  +Add Comment  (1 Comments)

You can use "On Error Resume Next" to suppress errors and "On Error Goto 0" to stop suppressing errors.
Posted By Mike Prestwood, Post #100411, KB Topic: Language Basics
  +Add Comment  (4 Comments)




Topic: Language Details

Use the scriptiing dictionary object which is available on later versions of ASP Classic (all still commonly in use). Both Access VBA and VB Classic use a collection for this but collections are not supported in ASP Classic.

Dim StateList
Set StateList = Server.CreateObject("Scripting.Dictionary")
StateList.Add "CA", "California"
StateList.Add "NV", "Nevada" 
Response.Write "I live in " & StateList.Item("CA")
Posted By Mike Prestwood, Post #101512, KB Topic: Language Details
  +Add Comment

Using a RecordSet's properties, methods and events.
Posted By Mike Prestwood, Post #100431, KB Topic: Language Details
  +Add Comment

Response.Flush sends the contents of the buffer to the browser. This command is useful for showing a visitor something while slow loading pages load.

Posted By Mike Prestwood, Post #100421, KB Topic: Language Details
  +Add Comment  (4 Comments)

Use Weekday and WeekdayName to return the day of week in ASP.
Posted By Mike Prestwood, Post #100100, KB Topic: Language Details
  +Add Comment




Topic: OOP

Ultra-primitive (no inheritance) but useful and encourages you to think and design using objects.

Posted By Mike Prestwood, Post #101398, KB Topic: OOP
  +Add Comment  (2 Comments)

When an object instance is created from a class, ASP calls a special parameter-less sub named Class_Initialize. Since you cannot specify parameters for this sub, you also cannot overload it.

When a class is destroyed, ASP calls a special sub called Class_Terminate.

Posted By Mike Prestwood, Post #101823, KB Topic: OOP
  +Add Comment  (1 Comments)

When an object instance is destroyed, ASP calls a special parameter-less sub named Class_Terminate. For example, when the variable falls out of scope. Since you cannot specify parameters for this sub, you also cannot overload it.

When an object instance is created from a class, ASP calls a special sub called Class_Initialize.

Posted By Mike Prestwood, Post #101830, KB Topic: OOP
  +Add Comment  (1 Comments)

ASP classic uses the property keyword and special Get and Let methods to both get and set the values of properties.

Posted By Mike Prestwood, Post #101749, KB Topic: OOP
  +Add Comment  (2 Comments)

The member visibility modifiers are Private and Public. If not specified, the default is Public. Private and Public have the usual meaning. Private members are visible only within the class block. Public members are visible within the class and outside of the class.

Posted By Mike Prestwood, Post #101956, KB Topic: OOP
  +Add Comment


Follow PrestwoodBoards on: 


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