Welcome to Bucaro TecHelp!

Bucaro TecHelp
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web

About Bucaro TecHelp About BTH User Agreement User Agreement Privacy Policy Privacy Site Map Site Map Contact Bucaro TecHelp Contact RSS News Feeds News Feeds

Victims of Sandy Hook

Stop the Slaughter of Innocents. Congress is bought and paid for by gun lunatics and gun promotion groups. If you want to live in a safe America, help buy Congress back for America. Send a donation to Mayors Against Illegal Guns, 909 Third Avenue, 15th Floor New York, NY 10022


The ASP (Active Server Pages) Object Model

ASP (Active Server Pages) is a server-side scripting engine first released in December 1996 as part of Microsoft's IIS (Internet Information Services). It allows dynamically generated web pages. After ASP.NET was released in January 2002, ASP became known as Classic ASP. Microsoft has promised to support Classic ASP until at least October 14, 2025.

As a server-side scripting engine, the ASP interpreter can run scripts written in VBScript, JScript and PerlScript. The interpreter reads and executes script code between the <% and %> tags. The default language is VBScript, but placing the the <%@ language="JScript"%> directive at the top of the page can be used to select a different language.

ASP runs only on Windows. Web pages that use ASP must have the .asp filename extension. The ASP Architecture consists of six built-in objects: Application, Session, Request, Response, ASPError, and Server.

The Application object stores global variables. Shown below is example code for storing the string "cart" in a global variable named "apName" in the Application object.

<%
Application("apName") = "cart"
%>

The Session object stores variables related to only to a single visitor. Shown below is example code for storing the string named "name" in a session variable named "apVisitor" in the Session object.

<%
Session("apVisitor") = "name"
%>

The Request object is used to read that was sent by the client's browser: Form, Querystring, or HTTP Cookie. Shown below is example code for reading data sent by the GET method.

<%
name = Request.QueryString("name")
%>

Request.Form reads data sent by POST.

The Response object is used to send information to the client's browser, such as the writing of the text on a page or HTTP Cookie. Shown below is example code for writing the text "Welcome" to the clients browser.

<%
Response.Write "Welcome"
%>

The Err object can be used for the management of errors. Shown below is example code for writing the details of the error to the clients browser.

<%
On Error Resume Next

If Err.Number <> 0 Then
     Response.Write "Error Number: " & Server.HTMLEncode(Err.Number)
     Response.Write " Error Source: " & Server.HTMLEncode(Err.Source)
     Response.Write " Error Description: " & Server.HTMLEncode(Err.Description)
     Err.Clear 
End If 
%>

The Server object can be used to create instances of components installed on the server. Shown below is example code of the server object creating a FileSystemObject object. The FileSystemObject object can be used to manipulate files, folders, and directory paths. The example code shown below creates a text file and then writes some text to the file

<%
dim fsObj, fname
set fsObj = Server.CreateObject("Scripting.FileSystemObject")
set fname = fsObj.CreateTextFile("test.txt", true)
fname.WriteLine("Hello World")
fname.Close
set fname = nothing
set fsObj = nothing
%>

The Server object can also be used to create connections to a database (ADO) and manipulation of the database.

RSS Feed RSS Feed

Follow Stephen Bucaro Follow @Stephen Bucaro

Fire HD
[Site User Agreement]  [Advertise on This site]  [Search This Site]  [Contact Form]
Copyrightę2001-2010 Bucaro TecHelp P.O.Box 18952 Fountain Hills, AZ 85269