Sambar Server Documentation

CScript Introduction


This document, the Sambar Server CScript Reference, contains information on how to write server-side ASP applications using the Sambar Server CScript language. This reference contains a brief introduction to the CScript language.

An introductory example
<html> <head> <title>Example</title> </head> <body> <% printf("Hello ASP world!"); %> </body> </html>

CScript differs from client-side JavaScript in that the code is executed on the server. The above script is executed on the server, resulting in the the client receiving the results of output (Hello ASP World!), with no way of determining what the underlying code was.

Note: In addition to using the symbols, <% code %> (Microsoft ASP default), ASP pages can contain <? code ?> (PHP default).

Microsoft's ASP

Many servers include some form of ASP (Active Server Pages) support. Microsoft's IIS Server contains the best known ASP functionality, with support for server-side JavaScript and VBScript. While the syntax for embedding CScript is the same as Microsoft's ASP syntax, and a config/globals.asa file looked for/loaded at startup and cached across servers as it is on Microsoft's implementation, the document models and language differences make the two implementations completely incompatible.

Security

CScript includes an ever-expanding set of functionality that attempts to rival the C development environment. As a result, whether whether used within the Sambar Server or executed as a separate executable (bin/icscript.exe), the environment is able to access files, execute commands and open network connections on the server. These properties make anything run on the web server insecure by default (Important! ASP pages can be disabled for the entire server via the config/config.ini file parameter Enable ASP or on a per directory basis using .htaccess files (option noexec). CScript is designed to be a more stable, flexible development platform than C, not a more secure environment. Note: The less functional, Sambar Scripting language is designed to be a secure, high-performance scripting environment.

Standard Function Libraries

Every compiler/interpreter comes with some standard predefined functions which are available for your use. These are mostly input/output functions, character and string manipulation functions, and math functions. In CScript, the standard function libraries are self-documenting, allowing users to browse them via a browser from the /syshelp manual pages. The list of support functions is expected to grow significantly from release to release.

Prerequisites

The core CScript engine is contained within the sambarcs.dll library and requires the sambarcm.dll library. There are no other libraries or installation requirements for the package.

Audience

The Sambar Server CScript Reference is written for programmers familiar with C, Java or JavaScript programming languages, as well as HTML.

© 2001 Sambar Technologies. All rights reserved. Terms of Use.