according to
http://msdn.microsoft.com/en-us/library/ms524620.aspx
you should use server.createObject
If you are already familiar with VBScript or JScript, note that you do not use the scripting language's function for creating a new object instance (CreateObject in VBScript or New in JScript). You must use the ASP Server.CreateObject method; otherwise, ASP cannot track your use of the object in your scripts.
but some other folks think that server.createObject implies an overhead that most times could be avoided
http://classicasp.aspfaq.com/components/should-i-use-createobject-or-server-createobject.html
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).
or
http://www.4guysfromrolla.com/webtech/043099-1.shtml
This can become significant if you are writing a component that deals with transactions, as it would be a good safety net to pass it through MTS, because you will be using MTS commands. However, if you are not using MTS, you could create processor and memory over head by passing it through Server.CreateObject. This makes it a better idea to use CreateObject, because it goes straight through.
so if I'm not using mts and need no access to the builtins asp's objects (like set d = createObject("scripting.dictionary") ) is it ok to just forget about the server.createObject and go with createobject ) ???
thanks a lot...
Those articles you are quoting are somewhat out-of-date. Since IIS 5 and COM+ on Windows 2000 and above using the straight CreateObject
is pretty much the same as using Server.CreateObject
.
The MTS/COM+ behaviour of either CreateObject
or Server.CreateObject
is now the same, this in part due to the fact that ASP itself runs as a COM+ application. You can specify that the ASP page starts a transaction and then using CreateObject
any object implementing IObjectContext will be invited to join the transaction etc.
The only real difference I know of is a legacy thing where a COM object being created may have OnStartPage and a OnEndPage method. Using Server.CreateObject
these methods are called when the object is created and just before the object is released. This doesn't happen with CreateObject
.