Skip navigation

The ASP Object Model

Microsoft Internet Information Server (IIS) implements Active Server Pages (ASP) as an OLE automation server that has a hierarchical object framework. Figure A presents the ASP object model. The primary object in the ASP programming model is the ScriptingContext object, which exposes the interaction of the client browser. Because the ScriptingContext object is always available to ASP applications, you don't need to explicitly create a reference to it. The ScriptingContext object contains the six primary ASP objects, five built-in objects, and the ObjectContext object. The five built-in objects are the Application object, the Request object, the Server object, the Sessions object, and the Response object.

All active Web sessions use the Application object to share information among all users of an ASP application. The Application object contains the Contents collection and the StaticObjects collection. Each Contents object in the Contents collection contains all the items for which you used ActiveX script commands to add them to the Web application. The StaticObjects collection contains all the objects for which you used the HTML <Object> tag to add them to the Web application. In addition, the Application object can contain user-defined objects that the Web application creates, and multiple users can share it.

The Request object receives requests from the Web clients. The Request object can receive all the data on the form, plus information about the current user. The Request object contains several collections, each of which represents a different set of information that can be returned for the Web client. Each ClientCertificate object in the ClientCertificate collection represents a certificate field that the Web client returns and that identifies the client. The Cookies collection contains a set of Web cookies, where each cookie contains a small amount of information about the Web user. The Forms collection contains a set of Form objects, and each object represents an HTML form. The QueryString collection contains a set of added URL arguments, and the ServerVariables collection contains a set of server environment variables.

You use the Server object to create other OLE objects that you want your Web application to use. For instance, the Server object's CreateObject method creates the ADO Connection and Recordset objects, which access SQL Server.

The Session object maintains information that relates to the current Web session. The Session object is much like the Application object, but the Application object pertains to all Web users, whereas the Session object refers only to the current Web session. The collection of Contents objects in the Session object contains all the items for which you used script commands to add them to the Web session. The ObjectContext object provides access to the current object's context. It typically instantiates MTS objects or controls database transactions.

The Response object writes information into the HTML stream and sends that information to the client browser. The Response object also supports a collection of cookies, where each cookie object contains information that can be written to the client system. The Request object can later read these cookies.

TAGS: SQL
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish