You have the option to implement in your component two methods that the server calls during page-level events. These are OnStartPage and OnEndPage methods.
When the server creates a component instance, it looks for OnStartPage and OnEndPage methods associated with that componentē“ IDispatch interface.
If the component has implemented these methods, the server will automatically call them when a Web page that uses that component is opened or closed.
The only exception to this are components created with application scope, which never receive OnStartPage or OnEndPage method calls. For more information about application-scope objects, see the Global File Reference.
Because application-scope objects do not receive a call to OnStartPage, they cannot depend on its functionality. It is recommended that your server component, regardless of scope, handle the situation in which the OnStartPage method fails or is not called.