Last updated: August 25, 2026.
The VBScript Scripting.Dictionary object stores key-value pairs. It is useful for lookups, counters, and small in-memory collections inside a Classic ASP request.
Create and populate a dictionary
<%
Dim prices
Set prices = Server.CreateObject("Scripting.Dictionary")
prices.CompareMode = vbTextCompare
prices.Add "widget", 12.50
prices.Add "gadget", 19.95
If prices.Exists("Widget") Then
Response.Write FormatCurrency(prices("Widget"))
End If
Set prices = Nothing
%>Set CompareMode before adding keys. Use vbTextCompare for case-insensitive text keys or vbBinaryCompare for exact matching.
Loop through keys
<%
Dim key
For Each key In prices.Keys
Response.Write Server.HTMLEncode(CStr(key)) & ": "
Response.Write Server.HTMLEncode(CStr(prices(key))) & "<br>"
Next
%>| Member | Purpose |
|---|---|
Add | Adds a new key and value. |
Exists | Tests whether a key is present. |
Item | Reads or replaces a value. |
Remove | Deletes one key. |
Keys, Items | Returns arrays for iteration. |
Do not store an unlocked dictionary in Application state and update it concurrently; use Application.Lock and Application.UnLock, or persistent storage designed for concurrent access.