Using the Chilkat ActiveX in Classic ASP
install once on the IIS server, then create Chilkat objects with Server.CreateObject
Windows · IIS, 32-bit or 64-bit application pools · VBScript or JScript pages · Chilkat ActiveX v11
The Chilkat ActiveX is a COM library, so Classic ASP pages can create Chilkat objects such as
Chilkat.Http, Chilkat.JsonObject, or Chilkat.Crypt2 and call their methods. That gives
an ASP site HTTP/REST calls, email, FTP/SFTP, Zip, PDF, encryption, digital signatures, JSON, XML, and the rest of the
Chilkat API. Chilkat runs on the web server, inside the IIS worker process.
The 60-second version
- On the web server, check the site's application pool: Enable 32-Bit Applications
Falsemeans 64-bit,Truemeans 32-bit. - Install the matching per-machine Chilkat ActiveX MSI on the server (or both, to be safe).
- Save the first page as
hello.aspin the site and browse to it.
On this page: Bitness Install Unlock First page JSON to a table ASP tips Troubleshooting
Setup
Find out whether the application pool is 32-bit or 64-bit
The Chilkat ActiveX DLL must have the same bitness as the IIS worker process (w3wp.exe) that runs the pages.
That is decided by the site's application pool, not by Windows:
- Open Internet Information Services (IIS) Manager on the server.
- Select the site, click Basic Settings, and note the Application pool name.
- Under Application Pools, select that pool and click Advanced Settings.
- Enable 32-Bit Applications:
False(the default) means the pool is 64-bit;Truemeans 32-bit.
If different sites on the server use pools of different bitness, or you aren't sure, install both the 32-bit and the 64-bit Chilkat ActiveX. They coexist without problems.
Install the Chilkat ActiveX on the web server
Use the per-machine installers. IIS runs pages under its own identities (the application pool identity and
IUSR), which can't see a Chilkat registered for your own Windows account only.
The per-machine installers put the DLL under Program Files, where the IIS identities can read it. If you
register the DLL yourself from the ZIP download on the ActiveX download page, run
register.bat as administrator, keep the DLL on a local drive, and make sure the application pool identity has
Read & execute permission on its folder. You don't need to restart IIS after installing. The downloads are the
full version and are fully functional for a 30-day
evaluation.
Unlock Chilkat in each worker process
Chilkat is unlocked once per process with UnlockBundle. IIS can run several worker processes and recycles
them, so the dependable approach is to call it on every page that uses Chilkat. It is fast, and calling it again is
harmless. Put the call in an include file:
<%
' chilkat_unlock.asp -- include this on every page that uses Chilkat.
Function ChilkatReady()
Dim glob, ok
Set glob = Server.CreateObject("Chilkat.Global")
ok = (glob.UnlockBundle("Anything for 30-day trial") = 1)
If Not ok Then Response.Write "<pre>" & Server.HTMLEncode(glob.LastErrorText) & "</pre>"
ChilkatReady = ok
End Function
%>
During the 30-day trial any string works; after purchase, use your license code. For other options, see Unlocking Chilkat in Classic ASP.
Examples
Your first page: fetch a URL
<%@ Language="VBScript" %>
<!--#include file="chilkat_unlock.asp" -->
<%
If ChilkatReady() Then
Dim http, s
Set http = Server.CreateObject("Chilkat.Http")
s = http.QuickGetStr("https://www.chilkatsoft.com/helloworld.txt")
If http.LastMethodSuccess <> 1 Then
Response.Write "<pre>" & Server.HTMLEncode(http.LastErrorText) & "</pre>"
Else
Response.Write "<p>" & Server.HTMLEncode(s) & "</p>"
End If
End If
%>
Browse to hello.asp. The page shows Hello World!. The ProgID is Chilkat. plus the
class name, for example Chilkat.JsonObject or Chilkat.Crypt2. Server.CreateObject and
plain CreateObject both work; Server.CreateObject reports failures as ASP errors with more
detail.
Show JSON from a web service as an HTML table
This page calls a URL that returns JSON, parses it with Chilkat.JsonObject, and writes an HTML table. The
same pattern works for any REST API: send the request with Chilkat.Http or Chilkat.Rest, then
read the fields with StringOf, IntOf, and SizeOfArray.
<%@ Language="VBScript" CodePage=65001 %>
<!--#include file="chilkat_unlock.asp" -->
<%
Response.CodePage = 65001
Response.Charset = "utf-8"
If ChilkatReady() Then
' {"apple":"red", "lime":"green", "banana":"yellow", ...}
Dim http, json, jsonText, i
Set http = Server.CreateObject("Chilkat.Http")
http.ConnectTimeout = 10
http.ReadTimeout = 20
jsonText = http.QuickGetStr("https://www.chilkatsoft.com/exampledata/sample.json")
Set json = Server.CreateObject("Chilkat.JsonObject")
If http.LastMethodSuccess <> 1 Then
Response.Write "<pre>" & Server.HTMLEncode(http.LastErrorText) & "</pre>"
ElseIf json.Load(jsonText) <> 1 Then
Response.Write "<pre>" & Server.HTMLEncode(json.LastErrorText) & "</pre>"
Else
Response.Write "<table><tr><th>Fruit</th><th>Color</th></tr>"
For i = 0 To json.Size - 1
Response.Write "<tr><td>" & Server.HTMLEncode(json.NameAt(i)) & "</td><td>" & _
Server.HTMLEncode(json.StringAt(i)) & "</td></tr>"
Next
Response.Write "</table>"
End If
End If
%>
CodePage=65001 and the two Response lines make the page UTF-8 end to end, so non-English text
from the web service displays correctly. See Using Non-usascii
Literal Strings in Classic ASP.
Things to know when calling Chilkat from ASP
Chilkat returns 1 or 0, not VBScript's True/False. Methods that report success, and properties such as
LastMethodSuccess, return 1 or 0. VBScript's True is -1, so
write If success <> 1 Then, never If success = True or If Not success
(Not 1 is -2, which is nonzero).
| Topic | What to do |
|---|---|
| Errors | Chilkat doesn't raise ASP errors for ordinary failures. Check the return value (or
LastMethodSuccess) and read LastErrorText. Log it rather than showing it to site visitors on a
public site, because it can include server paths and request details. |
| Object scope | Create Chilkat objects in the page that uses them. Don't store them in Session
or Application: Chilkat objects use the apartment threading model, and ASP either refuses to store such objects
in Application or ties the session to a single thread, which hurts performance. |
| Timeouts | A page that waits on a slow server holds an IIS thread. Set Chilkat timeouts such as
ConnectTimeout and ReadTimeout well below the page's Server.ScriptTimeout (90 seconds
by default). |
| File paths | Chilkat runs as the application pool identity. Use Server.MapPath to build full
paths, and grant that identity access to any folder Chilkat reads or writes. |
| JScript pages | Chilkat works the same way from JScript: var http =
Server.CreateObject("Chilkat.Http");. Compare results with != 1. |
| VBScript's future | Classic ASP pages written in VBScript use the Windows VBScript engine, which Microsoft has deprecated. See VBScript's future in Windows. |
| Chilkat v9.5 pages | v11 ProgIDs are Chilkat.Http, Chilkat.Global, and so on. Older
pages use Chilkat_9_5_0.Http. Both versions can be installed side by side; see
Chilkat ActiveX v11 and v9.5 on the same computer. |
Troubleshooting
| Message | Cause and fix |
|---|---|
| Server object error 'ASP 0177 : 800401f3' Server.CreateObject Failed Invalid class string |
The Chilkat ActiveX isn't registered for this application pool. Usually its bitness doesn't match the pool's Enable 32-Bit Applications setting, or it was installed per-user. Install the matching per-machine MSI, and check the ProgID spelling. |
| Server object error 'ASP 0177 : 80070005' Access is denied |
The application pool identity can't read the DLL. Move the DLL to a local folder the identity can read (such as the
per-machine install folder under Program Files), or grant Read & execute on its folder. |
| Microsoft VBScript runtime error '800a01ad' ActiveX component can't create object |
The same registration problem, reported by plain CreateObject. See the first row. |
| Object doesn't support this property or method | The method or property name is misspelled, or the installed Chilkat version is older than the one the page was written for. Check the name in the reference documentation. |
| The page works on your PC but not on the server | Chilkat is installed per-user or with the wrong bitness on the server, or a file path that exists on your PC doesn't exist (or isn't accessible) on the server. |
| A Chilkat method returns 0 or an empty string | The operation itself failed (a network error, a bad password, an invalid file path, and so on). Read
LastErrorText; it names the cause. |
Next Steps
- 📖 Chilkat Classic ASP Reference Documentation — every class, method, and property
- 💻 Chilkat Classic ASP examples — thousands of ready-to-run examples
- 📦 Chilkat ActiveX downloads (MSI installers and ZIP files)
- ✉ Contact Chilkat support
Windows, IIS, VBScript, and JScript are trademarks of the Microsoft group of companies.