Active Server - Comparing Server CreateObject And The 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")
  • %>

Apart from being slightly more succinct, the 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 , 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.

Go back