The interaction between Web clients and servers is complex, with many messages passed between the two.
However, most of the time we only need to work with one part of this complex interaction, for example a cookie sent by a user's browser to our Web server.
One of the goals of ASP, and object-oriented programming in general, is to hide unneeded complexity from the developer.
The designers of ASP have built a model of this complex interaction in the ASP object model. As we work with ASP, we will do so through the five "built-in" objects of ASP:
- Application,
- Request,
- Response,
- Server, and
- Session.
This section describes the intrinsic COM objects (ASP built-in objects) that are available to ASP pages. Using ASP built-in objects, you can access to information regarding the Web server,
- the client who is accessing a Web page,
- the Web application that contains the Web page, and
- the fields in the HTTP request and response streams.
The ASP built-in objects are organized by the type of information they contain.
The information in ASP built-in objects can also be obtained in a COM component or an ISAPI application.
The following table lists the technologies from which ASP built-in objects can be accessed and how to access them.
Each of the five objects is an object in the
object-oriented programming sense and can have its own properties and methods.
In procedural programming, you think about the algorithms and data structures that are used to model the problem and then divide the problem into a series of ever-smaller procedures. Object-oriented programming (OOP) is a programming language model organized around objects rather than "actions" and data rather than logic. Historically, a program has been viewed as a logical procedure that takes input data, processes it, and produces output data. The programming challenge was seen as how to write the logic, not how to define the data. Object-oriented programming takes the view that what we really care about are the objects we want to manipulate rather than the logic required to manipulate them. Examples of objects range from humans (described by name, address, and so forth) to cyborgs
(whose properties can be described and managed) down to the integrated circuits (such as CPU and ALU).
In object-oriented programming, you think about the overall system you are modeling and how the elements in the system interact with each other.
When programming using the object-oriented paradigm,
classes are the highest level elements.
In object-oriented programs, In procedural programs,
procedures are the highest-level elements. They define what the program does.
Classes correspond to real-world entities such as employees or automobiles. An
object is one instance of a class, much as 3 is an instance of a number and
hello is an instance of an English word. There are rules about how to add and subtract numbers, and they apply to all numbers. When you define a class, you are setting the rules for all the members (objects) of that class.
Objects combine data (also called attributes, variables, and state) with behavior (also called
methods, functions, and operations). An object holds information, and can do things with that information on request. The application of OOP to ASP objects is that each object we will encounter has properties and methods already defined. When you set a property (attribute) equal to a variable of the appropriate type and refer to one of the object's methods a known and consistent operation will occur on, or using, that property (or those properties).
In later modules, we will cover each of the objects in detail. Compare scripting alternatives for embedding programs in HTML.