Active Server - Comparing Server CreateObject And The object Tag In ASP
As you may know, there are two ways you can create a COM object in Active Server Pages.
These two equivalent methods are shown here:
- 'Using Server(.)CreateObject
- Dim fso
- Set fso = Server(.)CreateObject_("Scripting(.)FileSystemObject")
- !-- Using the object> tag -->
- object runat="server" id="fso" progid="Scripting(.)FileSystemObject">
Apart from being slightly more succinct, the object> tag method has another advantage.
When you use Server(.)CreateObject, the COM object is instantiated immediately,
whether you actually end up using it or not. With object>, on the other hand, the object isn't instantiated at all
until the first time you set one of its properties or call one of its methods. This can help you converse
memory in an application where every byte counts.