The manual Page
Version française
   
index | glossary | news | downloads | links ]
  introduction à ASP
écrire en ASP
le fichier global.asa
les variables
les objets ASP 3.0
l'objet Request
l'objet Response
l'objet ObjectContext
l'objet Application
l'objet Session
l'objet Server
l'objet ASPError
 
news
glossary
links
downloads
 
credits
contact
 
 
search
 
last update
19/02/2003
Valid HTML 4.0!
Valid CSS!
Hit-Parade
Mesurez votre audience


  The ASP 3.0 objects

Presentation

As we saw it in the introduction, ASP 3.0 uses different objects to describe the interactions between the client and the Web server. Their are 7 of them:

An ASP object may be made 3 elements: properties, methods and collections. A collection is an associative array (an array that may be indexed by anything, like strings). For instance, ASP builds a dedicated collection in the Request object (Server.Form) to store the content of a form. We use these 3 elements as we ordinary use the properties and methods of an object in the language we chose to write the ASP code (mostly object.element).

These various objects are used in different scopes. We can represent these scopes on the following sketch:

The 7 ASP 3.0 objects

The Request object

The Request objects represents the query a Web browser sends to the Web server to retrieve the ASP page. This object contains in different collections the HTTP message the client has sent to the server. For instance, this object holds a special collection to store the content of a form we have sent to the server.

This object has only one property and one method. This object is mostly made of collections:

properties collections methods
TotalBytes ClientCertificate
Cookies
Form
QueryString
ServerVariables
BinaryRead

The Response object

The Response object represents the HTTP response to to request of the client. It is the header of the response (the HTTP status for example) as well as the body of the response (the HTML page). We use this object to write the dynamic content from the ASP code, in particular thanks to the Write method.

This object has more methods and properties than the object Request, but it has only one collection:

properties collections methods
Buffer
CacheControl
Charset
ContentType
Expires
ExpiresAbsolute
IsClientConnected
PICS
Status
Cookies AddHeader
AppendToLog
BinaryWrite
Clear
End
Flush
Redirect
Write

The ObjectContext object

The ObjectContext object is used to control the ASP transactions that are ordinary managed the Microsoft transaction server (MTS).

It is necessary to use the ASP directive @Transaction on the first line of the ASP script in order to be allowed to use this object. When this directive is used, the ASP page runs in a transaction and does not finish processing until the transaction either succeeds completely or fails.

The object ObjectContext only has 2 methods to "force" the validation or the abortion of the transaction. 2 events allow you to implement specific behaviors (procedures defined in the current script file) when the transaction succeeds or fails.

methods events
SetAbort
SetComplete
OnTransactionAbort
OnTransactionCommit

The Application object

The Application object represents the Web application. It is a container that holds the dynamic data available to all visitors (the number of currently connected visitors). To simplify, the Application object holds the global variables of the application.

The Session object

The Session object is used to manage the ASP sessions. A session is an environment peculiar to each visitor; it is mostly used to store visitor-specific data (for instance, the list of articles he is buying on a merchant Web site). These data are available for a given length of time.

The Server object

The Server represents the Web server and the ASP engine. We use this object to manage some parameters of the Web server and instanciate user objects.

The ASPError object

The ASPError object collects information about the errors that occurs while processing the ASP code of the page.

printable format printable format



Copyright © 2000-2002 themanualpage.org - This site is submissive to the terms of the GNU GPL and FDL licences.