Most of my code uses CreateObject, rather than Server.CreateObject.
I used to have a strong opinion that Server.CreateObject was
somehow better, but in most cases, I no longer believe that.
CreateObject has less overhead than Server.CreateObject, because
the latter uses MTS causing significant overhead.
You will also suffer performance hits when the component encounters
errors, because with Server.CreateObject, these errors are written
to the event log (which, admittedly, can be useful during
debugging).
You cannot use Server.CreateObject when accessing a component
through a firewall. See KB #193230 for more information.
However, keep in
mind that there are cases where you actually need
to use Server.CreateObject.
If you are using and relying on MTS to handle transactions in your
application, you cannot do this with CreateObject.
If you are using a custom or 3rd
party component, such as
ASPUpload, that uses the ASP intrinsic objects (Server, Request,
Response, Application, Session, ASPError, ObjectContext),
CreateObject alone does not provide the component with access to
these objects.
If you have a legacy component that relies on the onStartPage and
onEndPage methods, their firing cannot be relied upon with
CreateObject alone.
Note that I use VBScript for just about all of my ASP code. If you
are using JScript or JavaScript as your server-side language, the
Server. prefix is not optional. See Article #2382 for details.
[ Comment, Edit or Article Submission ]