170 likes | 332 Views
Active Server Pages. Points of Interest Chapters 1-4. ASP versus HTML. Major differences? What can ASP do that HTML cannot?. Active Web Sites. ActiveX controls - Visual C++ or Visual Basic Create a functionality Java Scripting Languages (VBScript, JavaScript) ASP and Dynamic HTML.
E N D
Active Server Pages Points of Interest Chapters 1-4
ASP versus HTML • Major differences? • What can ASP do that HTML cannot?
Active Web Sites • ActiveX controls - Visual C++ or Visual Basic • Create a functionality • Java • Scripting Languages (VBScript, JavaScript) • ASP and Dynamic HTML
Running ASP • PWS, IIS, Chilisoft
ASP Pitfalls and Editing • Open from the server URL instead of the pathname. • What does P&U primarily use for an editor? • Did people get InterDev 6.0 yet?
ASP Objects • Request: to get information from the user • Response: to send information to the user • Server: to control the Internet Information Server • Application: to share application-level information and control settings for the lifetime of the application • Session: to store information about and change settings for the user's current Web-server session • ObjectContext: (used mostly with MTS)
ASP Objects • Each set of objects has a set of functions it can perform called methods and one or more properties • value = object.property • value = object.method() • Some newer objects at http://msdn.microsoft.com/workshop/server/asp/comtutorial.asp
Order of Execution • global.asa (Text file with details about an ASP application, such as when it should begin and end [more in CH9]) • Server-side includes • <SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT> • <!--#include file="header.inc"--> (refers to current directory) • <!--#include virtual="common/header.inc"--> (refers to root of system) • Jscript/JavaScript tagged within <SCRIPT> • HTML with Scripts tagged within <% … %> • VBScript tagged within <SCRIPT> tags
A sample (from ASP text) • Using a form to get information and display it. . .
Variables • Naming variables in VBScript • 255 characters • Must begin with an alphabetical • Must not contain an embedded period • Not case-sensitive
The Variant • All variables in with different data types are of one type • variant • Can use the TypeName () funtion to determine the subtype of the variant • PieceofString = 5 • WhatTypeofVar = TypeName (PieceofString)
Conversions • Since variants are automatically a subtype when a value is assigned to them, sometimes one needs to change the subtype • Check page 111-112) for functions
Some Interesting Items • Assignment Operator Number1 = 2 Number1 = Number1 + 1 • Comparison If Number1 = 2 Then. . . • Concatenating Variants (subtype string) strConcatenate = "Helter" & "Skelter" strConcatenate2 = "Helter" & " " & "Skelter" • Naming Conventions (114)
Dim and Option Explicit • DIM (aka dimension) Dim ComputerSystem ComputerSystem = "Amiga" • Option Explicit: every variable in the program must be explicitly declared in the code before it is used. • First line in a client-side script • Before <HTML> when using server-side <%Option Explicit%>
Variable Scope • Local Variables (122-123) • Global Variables (125) <% strGlobal = "Global or Script Level Variable"%> • Private strGlobal (just within script declared) • If in client-side ends when script does • If in a server-side <% %> should last in ASP page/session
Arrays and Multi-Dimensional Arrays • Declaring • Loop • Dim and Redim • Preserve • Multi-dimensional