Constants in Classic ASP and VBScript

Last updated: August 27, 2026.

A VBScript constant gives a stable name to a value that should not change while the page runs. Declare application-specific constants with Const.

Declare and use constants

<%
Const TaxRate = 0.0825
Const SiteName = "WebCheatSheet"
Const MaxItems = 100

Dim subtotal
subtotal = 50
Response.Write Server.HTMLEncode(SiteName)
Response.Write " total: " & FormatCurrency(subtotal * (1 + TaxRate))
%>

VBScript also supplies named constants through components and type libraries. Use descriptive names, keep secrets in protected configuration rather than constants, and avoid duplicating the same business value across many pages.

admin

admin

Leave a Reply

Your email address will not be published.