ASP
  Home arrow ASP arrow Page 3 - Introduction To The GLOBAL.ASA For ASP Pro...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP

Introduction To The GLOBAL.ASA For ASP Programmers
By: Rich Smith
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 51
    2003-07-16

    Table of Contents:
  • Introduction To The GLOBAL.ASA For ASP Programmers
  • Inside the GLOBAL.ASA File
  • Application and Session Objects
  • Type libraries for COM

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Introduction To The GLOBAL.ASA For ASP Programmers - Application and Session Objects


    (Page 3 of 4 )

    Moving along, the next thing we can do inside of the GLOBAL.ASA is object declarations. In other words, you can create a reference to an object with session or application scope to be used by any of the ASP pages in the application. This can be accomplished by utilizing the <object> tag.

    When declaring an object, you need to follow a specific syntax, as follows:


    <OBJECT id=id } |classid="classID" {progid="progID" scope="scope" runat="server"></OBJECT>



    Follows are descriptions for each parameter:

    • Scope – Sets the scope of the object. Can be either session or application.
    • Id – A unique ID for the object.
    • ProgID – The progID for your object, in the proper format.
    • ClassID – The unique ID for the COM class object.


    Note – Either a ProgID or a ClassID must be specified.

    Here is an example of a GLOBAL.ASA with a declaration for the Microsoft Ad Rotator.


    <SCRIPT language=vbscript runat="server">

    Sub Application_OnStart
      
    ...
    End Sub

    Sub Application_OnEnd
      
    ...
    End Sub
    </SCRIPT>

    <OBJECT id=AdObject progid="MSWC.AdRotator" scope="session" runat="server"></OBJECT>

    You will notice that the <object> tag is outside of the <script> tag in the above example. This is the required format. To utilize the object in any ASP page, you would do the following:

     This is an advertising page <%=AdObject.GetAdvertisement("/myads.txt")%>


    More ASP Articles
    More By Rich Smith


     

    ASP ARTICLES

    - Using MySQL with ASP
    - ADO for the Beginner
    - ADO.NET 101: Data Rendering with a DataGrid ...
    - Introducing SoftArtisans OfficeWriter 3.0 En...
    - Getting Remote Files With ASP
    - The Real Basics of Functions in ASP
    - Enhancing Readability with ASP
    - Mimicking PHP's String Formatting Functions
    - Windows Server Hacks 12, 77, and 98
    - How to Sort a Multi-Dimensional Array
    - Developing an Information Management Tool wi...
    - What are Active Server Pages?
    - Getting Remote Pages with ASP
    - FTP’ing Files with ASP
    - Apply Single-Sign-On to Your Application

     
    Application Delivery: Everything You Wanted to Know, but Didn`t Know You Needed to Ask
    A comprehensive guide to examining the topics of Wide-area Data Services and app....

     
    Best Practices: Safe and Secure Hardware Asset Recovery
    Companies increasingly must meet EPA and local requirements for the disposal of ....

     
    Managing SSL Security in Multi-Server Environments
    Read this white paper to learn how to simplify management of your organization's....

     
    Open Source Security Myths
    Open Source Software (OSS) is computer software whose source code is available t....

     
    Power and Cooling Capacity Management for Data Centers
    This paper describes the principles for achieving power and cooling capacity man....

     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT