News:

GinGly.com - Used by 85,000 Members - SMS Backed up 7,35,000 - Contacts Stored  28,850 !!

Main Menu

<object> Declarations In Global.asa file

Started by VelMurugan, Dec 16, 2008, 06:35 AM

Previous topic - Next topic

VelMurugan

<object> Declarations

It is possible to create objects with session or application scope in Global.asa by using the <object> tag.
Note: The <object> tag should be outside the tag!

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



QuoteParameter       Description
scope             Sets the scope of the object (either Session or Application)
id                  Specifies a unique id for the object
ProgID            An id associated with a class id. The format for ProgID is [Vendor.]Component[.Version]
                     Either ProgID or ClassID must be specified.
ClassID          Specifies a unique id for a COM class object.
                     Either ProgID or ClassID must be specified.

Examples

The first example creates an object of session scope named "MyAd" by using the ProgID parameter:

<object runat="server" scope="session" id="MyAd"
progid="MSWC.AdRotator">
</object>



The second example creates an object of application scope named "MyConnection" by using the ClassID parameter:

<object runat="server" scope="application" id="MyConnection"
classid="Clsid:8AD3067A-B3FC-11CF-A560-00A0C9081C21">
</object>



The objects declared in the Global.asa file can be used by any script in the application:

GLOBAL.ASA:

<object runat="server" scope="session" id="MyAd"
progid="MSWC.AdRotator">
</object>


You could reference the object "MyAd" from any page in the ASP application:

SOME .ASP FILE:

<%=MyAd.GetAdvertisement("/banners/adrot.txt")%>

Source : ExpertsForge