Page #25 (Chapter 3 - Building ASP Applications)

Chapter 3 - Building ASP Applications

Visual Basic Developers Guide to ASP and IIS
A. Russell Jones
  Copyright 1999 SYBEX Inc.

Understanding Language Independence
ASP pages can be written in several scripting languages because the ASP engine is a scripting host, not a language. Currently, VBScript and JScript (Microsoft's implementation of ECMAscript) are included with the ASP engine installation, but you can also use Practical Extraction and Report Language (Perl), Restructured Extended Executor (REXX), or any language that conforms to the Microsoft debugging protocol. Almost all the code examples in this book use VBScript (this is, after all, a book about VB). However, you will see some JavaScript as well because you're going to write browser-independent applications, and you can't use VBScript for client-side script unless you're running Internet Explorer.
The ASP engine even supports pages written in more than one language. Each ASP page has a primary language, designated by the <%@ LANGUAGE= %> directive at the top of each page.
Within a page however, you can use other languages by wrapping the code in <script></script> tags, for example:
<script language=someLanguage runat=server></script>
Each page in an ASP application can set the default language for that page.
If you use multiple languages on a single page, or for any server-side script contained in <script></script> tags, remember to include the runat=server parameter and value. Otherwise, the parsing engine will think you're writing client-side code. You must always keep in mind whether you're writing code that will execute on the browser or on the server. On the server, you have access to the ASP objects—the Server, Application, Session, Request, and Response objects. On the client, you have access to the document and all its properties and methods.
This can be a tough concept to master, because you probably haven't written code in an environment where you're mixing and matching server-side code, client-side code, and HTML all in a single file.
Always remember:
  Code inside code-delimiter brackets (<% and %>) runs on the server.
  Code outside the brackets that is wrapped in <script></script> tags will run on the client unless the <script> tag includes the runat=server parameter.
  The ASP engine sends all other text in the page to the browser as part of the response. Usually, this other text consists of HTML tags and content.



Visual Basic Developer[ap]s Guide to ASP and IIS
Visual Basic Developer[ap]s Guide to ASP and IIS
ISBN: 782125573
EAN: N/A
Year: 2005
Pages: 98

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net