QuadooIIS.dll
QuadooIIS.dll hosts QuadooScript directly in the native IIS request pipeline. Map ordinary HTTP routes to Quadoo server pages (.qsp) and use a dedicated, guarded route for WebSockets. IIS still controls the application pool, authentication, TLS, request filtering, and worker lifetime. Classic ASP and ActiveScript registration are not needed for the native routes.
Configure IIS
This guide assumes 64-bit QuadooScript is installed in C:\Program Files\QuadooScript and is enabled only for Default Web Site. Keep the x64 runtime DLLs from the same build together in the installation directory, including QuadooVM.dll, QuadooParser.dll, JSON.dll, and SimbeyCore.dll. The IIS worker must be able to read the files. Install the matching Visual C++ runtime if required by the build.
- Use a 64-bit pool. Use integrated pipeline mode for the pool assigned to Default Web Site. Set Enable 32-Bit Applications to False and use the
bitness64precondition. - Register the native DLL. Add it once to the server's
globalModules. This makes the module available by name; it does not enable the module for every site. Do not useregsvr32to install this module. - Enable it for Default Web Site. Add the module and the
*.qsphandler at the site root. The handler requires an existing script file. Ensure the site's handler access policy permits scripts and this mapping is selected ahead of any catch-all static handler. - Verify routing before publishing scripts. Confirm the effective module and handler mapping for Default Web Site. Test a simple
.qsprequest, including on any alternate bindings. Do not add a static MIME mapping for script extensions. A wrong architecture or missing handler must not make script source downloadable.
Run these examples in an elevated Windows Command Prompt (cmd.exe). Inspect existing entries first and avoid adding duplicates. The first command that changes IIS registers the DLL at the server level. The module and handler are enabled only at Default Web Site/, the site's root application.
set "APPCMD=%windir%\System32\inetsrv\appcmd.exe"
"%APPCMD%" set config /section:system.webServer/globalModules ^
/+"[name='QuadooIIS',image='C:\Program Files\QuadooScript\QuadooIIS.dll',preCondition='bitness64']" /commit:apphost
"%APPCMD%" set config "Default Web Site/" /section:system.webServer/modules ^
/+"[name='QuadooIIS',preCondition='bitness64']" /commit:apphost
"%APPCMD%" set config "Default Web Site/" /section:system.webServer/handlers ^
/+"[name='QuadooPages',path='*.qsp',verb='GET,HEAD,POST',modules='QuadooIIS',resourceType='File',requireAccess='Script',preCondition='bitness64']" /commit:apphost
"%APPCMD%" list config "Default Web Site/" /section:system.webServer/modules
"%APPCMD%" list config "Default Web Site/" /section:system.webServer/handlers
See Microsoft's documentation for native module registration and bitness, application modules, and handler mappings. If IIS rejects an upload before the module runs, check the application's request filtering limits as well as QuadooIIS's own limit.
Build a Server Page
A .qsp file uses <% ... %> for script and <%= expression %> for output. There is no ASP language directive. Put output-producing template markup inside main() by closing and reopening a script block within the function. Use <!-- #include file="..." --> for a relative include. Includes may themselves include files, resolved relative to the file containing the directive.
hello.qsp
<%
extern Response;
function main ()
{
Response.ContentType = "text/html";
%><!doctype html>
<title>Hello from QuadooIIS</title>
<h1>Hello from QuadooIIS</h1>
<!-- #include file="caption.inc" -->
<p>Six times seven is <%= 6 * 7 %>.</p>
<%
}
%>
Save hello.qsp at the root of Default Web Site and put caption.inc beside it with the contents <p>This line came from an include.</p>. Request /hello.qsp and look for both the caption and the number 42. Do not serve include files directly, especially those containing script. Expressions write their result without HTML escaping, so do not put untrusted input into HTML without escaping it for the output context.
Declare the built-in objects you need. Request.QueryString["name"] reads a query value, Request.Form["name"] reads a parsed body field, Request.ServerVariables["REQUEST_METHOD"] reads an IIS server variable, and Request.Cookies["name"] reads a cookie. Response.Write(), Response.ContentType, and Response.AddHeader() let the script construct the response.
Use Response.AddCookie(name, value) to set a cookie. The host's Session["key"] stores per-session values, using the QUADOOSESSIONID cookie. Session data is in worker memory, expires after eight hours of inactivity, and does not survive a recycle or follow a request to another worker. If cookies are unavailable, do not assume subsequent requests will share a session.
To compose server-side pages, Server.Execute("/path/child.qsp") runs the child and returns to the caller. Server.Transfer("/path/child.qsp") hands control to the child without a client redirect. Request, response, and session state are shared along that execution chain. Use fixed or allowlisted paths, not paths provided by the client.
Build an HTTP Service
For a JSON POST, send UTF-8 with Content-Type: application/json and read Request.JSON. An object body also exposes its top-level fields through Request.Form. Keep query and body values separate when they have different meanings. Do not call Host.ParseFiles() in a QSP: the native host already supplies its request object.
echo-json.qsp
<%
extern Request;
extern Response;
function main ()
{
var oReply = JSONCreateObject();
oReply.echo = Request.JSON;
oReply.query = Request.QueryString["label"];
Response.ContentType = "application/json";
Response.AddHeader("Cache-Control", "no-store");
Response.Write((string)oReply);
}
%>
Save the following UTF-8 JSON as request.json:
{"message":"Hello","count":2}
curl.exe --fail-with-body -H "Content-Type: application/json" --data-binary "@request.json" "http://localhost/echo-json.qsp?label=demo"
The reply contains the original JSON value in echo and "demo" in query. The example only echoes data. A real service should restrict methods, authenticate callers, validate the JSON shape and field sizes, and avoid exposing diagnostics or sensitive values to clients.
Read a File Upload
For multipart/form-data, the name in the form identifies the uploaded binary object. Send a field named upload to this example; it reports the byte count and does not write to disk.
<%
extern Request;
extern Response;
function main ()
{
var oFile = Request.Files["upload"];
var oReply = JSONCreateObject();
oReply.received = oFile != null;
if(oFile != null)
{
oReply.fileName = oFile.FileName;
oReply.contentType = oFile.ContentType;
oReply.bytes = oFile.Size;
}
Response.ContentType = "application/json";
Response.Write((string)oReply);
}
%>
curl.exe --fail-with-body -F "upload=@sample.bin" "http://localhost/upload.qsp"
For a raw binary request such as application/octet-stream, Request.GetDefaultForm() without an argument returns the entire body as a binary object. An uploaded filename and content type are client claims. If you save uploads, assign a server-generated filename and keep the files outside the public document tree. QuadooIIS reads the request body asynchronously before running the page. The current native limit is 20 MiB; exceeding it returns HTTP 413 if IIS has not rejected the request first. The body is buffered, so set lower application-specific limits for endpoints that need less.
Host a WebSocket Endpoint
Enable IIS's WebSocket Protocol role service or Windows feature and check that webSocket is enabled for Default Web Site. Keep the standard IIS WebSocketModule active. A second registration of the same protocol module can intercept the upgrade. Use one native handler for the endpoint. If ActiveQuadoo already handles *.qws, ensure the exact echo.qws mapping takes precedence without affecting other routes.
Guard the Route Before Adding the Handler
Do not publish a raw WebSocket script on an unguarded route. QuadooIIS selects the WebSocket handler from the upgrade header. A request without an upgrade falls back to page processing, where raw WebSocket source could be returned as page text. Block ordinary HTTP at the IIS or proxy layer before exposing the file, and ensure the file has no alternate public URL or static fallback.
For example, with the separate IIS URL Rewrite module installed, put this distributed rule first in the inbound rules for the root of Default Web Site. It rejects an ordinary request to echo.qws before the handler runs. This is a routing guard, not authentication or a replacement for IIS's WebSocket handshake validation.
<rewrite>
<rules>
<rule name="Require WebSocket upgrade for echo.qws" stopProcessing="true">
<match url="^echo\.qws(?:/.*)?$" ignoreCase="true" />
<conditions logicalGrouping="MatchAny">
<add input="{REQUEST_METHOD}" pattern="^GET$" negate="true" />
<add input="{HTTP_UPGRADE}" pattern="^\s*websocket\s*$" ignoreCase="true" negate="true" />
<add input="{HTTP_CONNECTION}" pattern="(?:^|,)\s*upgrade\s*(?:,|$)" ignoreCase="true" negate="true" />
</conditions>
<action type="CustomResponse" statusCode="400" subStatusCode="0"
statusReason="WebSocket upgrade required" statusDescription="Use a WebSocket client." />
</rule>
</rules>
</rewrite>
Merge the rule under the system.webServer section for Default Web Site. Then add an exact-file mapping in the site's handlers collection ahead of any broader mapping. This example uses the x64 module and pool from the setup section.
<add name="QuadooEchoSocket" path="echo.qws" verb="GET"
modules="QuadooIIS" resourceType="File" requireAccess="Script" preCondition="bitness64" />
echo.qws
Save this as raw QuadooScript, without page delimiters. websocket() returns the object implementing IWebSocket. The host requires OnPacket(vPacket) and looks for optional OnOpen() and OnClose(nStatus, strReason) methods.
extern Host;
interface IWebSocket
{
virtual function OnOpen () = 0;
virtual function OnPacket (vPacket) = 0;
virtual function OnClose (nStatus, strReason) = 0;
};
class CEchoSocket : IWebSocket
{
virtual function OnOpen ()
{
Host.Send("Quadoo WebSocket ready");
}
virtual function OnPacket (vPacket)
{
Host.Send(vPacket);
}
virtual function OnClose (nStatus, strReason)
{
Host.Close(nStatus, strReason);
}
};
function websocket ()
{
return new CEchoSocket;
}
IIS completes the HTTP upgrade with status 101 before OnOpen(). Reads, writes, and close replies are asynchronous. The host assembles fragments before calling OnPacket(). Text arrives as a string and binary data as a binary object; passing either to Host.Send() preserves its message type. Keep callbacks short and bound work on client-provided messages. For a subprotocol-aware endpoint, the alternate factory signature is websocket(strProtocols, strExtensions). Inspect the offers and use Host.SetHeader() during the factory call to select a supported offered subprotocol, before the upgrade is sent.
Try It from a Browser
Save echo.qws at the root of Default Web Site after the guard is in place. From the developer console of a page served by that site, run the following example. An HTTPS page uses wss:; use HTTPS and wss: for public traffic.
const url = new URL("/echo.qws", location.href);
url.protocol = location.protocol === "https:" ? "wss:" : "ws:";
const socket = new WebSocket(url);
socket.addEventListener("open", () => socket.send("Hello, QuadooIIS!"));
socket.addEventListener("message", event => console.log(event.data));
socket.addEventListener("close", event => console.log(event.code, event.reason));
// After seeing the greeting and the echo:
// socket.close(1000, "Done");
Also make a plain HTTP GET to echo.qws and confirm it is rejected without returning source. Repeat that check for alternate paths or rewrites that could address the same file. For a real application, enforce authentication and browser origin policy at the handshake, authorize actions in messages, and test through any proxy that terminates TLS or forwards the upgrade.
Run Delayed Timer Callbacks
Call Host.StartTimer(name, delayMilliseconds, value) from a QSP page or WebSocket script. The payload must be JSON-compatible. The first call for a name starts a one-shot timer. Subsequent calls while it is pending append to that timer's queue in order; they do not reset its due time or replace the script that owns the callback. Use application-specific names because the timer map is shared within the module's worker process.
The owning script defines TimerMain(name, values), or TimerMain(values) if it does not need the name. The callback runs in a fresh VM with a timer host, not on the originating HTTP request or socket. It can schedule more timers and use timer-host facilities such as Host.Output(). Its root is available through Host.MapPath("/"). Pass the needed data explicitly; do not expect the old request, response, session, connection, or VM variables to be available. Avoid request-dependent work in top-level initialization because it is run again by the timer VM.
queue-demo.qsp
<%
extern Host;
extern Response;
function TimerMain (strName, aValues)
{
for(int i = 0; i < len(aValues); i++)
{
var oJob = aValues[i];
Host.Output(strName + ": " + oJob.message + "\r\n");
}
}
function main ()
{
var oJob = JSONCreateObject();
oJob.message = "A delayed callback ran";
Host.StartTimer("DefaultWebSite:notice", 2000, oJob);
Response.ContentType = "text/plain";
Response.Write("Queued. Check the worker's debug output.");
}
%>
Hit the page more than once in the two-second window to queue more than one payload. To cancel a pending timer, call Host.StopTimer(name); a successful cancellation returns the queued values. The callback can already be running when cancellation is attempted, and stopping an unknown name can raise an error. Timers are in-memory and best-effort: a recycle or shutdown can lose pending work. Use an external durable queue or scheduler when jobs must survive a restart, run only once across workers, or be retried reliably.
Choose Between QuadooIIS and ActiveQuadoo
Choose QuadooIIS.dll for new IIS-hosted QuadooScript pages and HTTP services when you want a native handler and do not need Classic ASP. It offers a direct request/response model, asynchronous body reads and WebSockets, template preprocessing, and native request parsing without an ASP language directive or an ASP Request wrapper.
Keep ActiveQuadoo.dll where an application depends on Classic ASP's object model, its existing .asp routes, or another ActiveScript host. Both hosts can process JSON and uploads and offer WebSockets and delayed timers. Those features alone are not a reason to migrate.
For a gradual migration, leave existing ASP mappings in place and start with a small native .qsp route on Default Web Site. Remove ASP language directives and Host.ParseFiles() from migrated pages. Retest ASP-specific response properties, COM dependencies, authentication, session assumptions, and transfer behavior rather than assuming source compatibility. Keep each WebSocket endpoint mapped to exactly one host and verify non-upgrade requests cannot see script source.