ASPNL logo (1 kb)
Thursday, November 20, 2008

powered by


Microsoft ASP.NET Connections
Member of ASP Guild
<< previous | index

Choosing another script language

You can develop ASP pages in different script languages. VBScript and JavaScript are standard installed with IIS, but PerlScript and REXX for example can also be used when their scripting engine is installed.

For every application in IIS (or PWS) the standard script language can be adjusted (provided this is installed of course). This language is being used by default, when the page directive doesn't say otherwise. The standard setting for this is VBScript.

How do I change the script language?

You can change the standard script language in the configuration of the application (in IIS or PWS). You can find this in the properties of an application.

You can use a different language then the default script language in a page, by stating the script language in the directive on the first line of the page, as follows:
<%@ Language=JavaScript %>

With the code above JavaScript will be the default language within the page.

It's also possible to write parts of the code in another language within a page. This code has to be placed between special tags that state in which scripting language the code is written. This looks as follows:
<%
'Code in the default script language for the page goes here
>%

<SCRIPT LANGUAGE=javascript RUNAT=Server>
//Code in JavaScript goes here
</SCRIPT>


You can have several of these code block in a page, each with a different language. Be aware however that code between <script> tags is executed after all code between <% and %> has been executed, no matter what the position of the in the <script> block is within the page. Functions and procedures in this code however can be called from the regular script code.

Why would I use another script language?

Most people prefer the language they're working with. And one language is more suitable for certain tasks then others. For example JavaScript and PerlScript are practical for manipulating strings. One of the advantages of VBScript is that it's easy to learn and very easy readable, even if you've never used VBScript.

It's not wise to use a lot of different script languages in one page. ASP has to change scripting engine for each of the different code blocks, and that takes time.

<< previous | ^ to top | index
copyright 2000-2002 ASPNL