Difference between Server.CreateObject and CreateObject in an ASP? 
Author Message
 Difference between Server.CreateObject and CreateObject in an ASP?

Is there any difference between Server.CreateObject and CreateObject in an
ASP?

I accidently left out the Server on some code i.e.

    Set dicX = CreateObject("Scripting.Dictionary")
    Set xmlDoc = Server.CreateObject("MSXML2.DOMDocument")

And they both work (in an .asp)

Is there any ramification with performance/threading, etc.

Thanks in advance ...



Mon, 30 Aug 2004 06:52:10 GMT  
 Difference between Server.CreateObject and CreateObject in an ASP?
Lifted from Google at some point (don't have the original reference):

What's the difference between CreateObject and Server.CreateObject? They
seem like they should be interchangable, but using the wrong one can cause
your ASP application to fall flat on it's face.

VBScript's CreateObject method creates instances of objects inside the
scripting engine's context and not in the context of the currently executing
ASP page. This works fine in a single user environment, but on a web server
it not only prevents the object from gaining access to the ASP intrinsics or
the values from the current page, it also bypasses the memory management and
process isolation benefits you get automatically when you use
Server.CreateObject.

When working with ASP files, we've yet to find any benefit (or any reason at
all) to use VBScipt's CreateObject over the one available from the Server
object. So make sure that every time you use CreateObject you use
Server.CreateObject.

Also see articles:
http://support.microsoft.com/?scid=KB;;Q193230
http://support.microsoft.com/?scid=KB;;Q243548


Quote:
> Is there any difference between Server.CreateObject and CreateObject in an
> ASP?

> I accidently left out the Server on some code i.e.

>     Set dicX = CreateObject("Scripting.Dictionary")
>     Set xmlDoc = Server.CreateObject("MSXML2.DOMDocument")

> And they both work (in an .asp)

> Is there any ramification with performance/threading, etc.

> Thanks in advance ...



Mon, 30 Aug 2004 06:47:39 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. The difference between CreateObject and Server.CreateObject

2. understand the following Pascal

3. Queries' columns union

4. Server.CreateObject() or CreateObject()

5. createobject(progid,server) vs. createobject(progid)+registry

6. Invalid Classtring on Win98

7. Delphi, dBase and indexes...

8. CreateObject vs Server.CreateObject

9. CreateObject vs. Server.CreateObject

10. ASP 0178: Server.CreateObject Access Error

11. ASP 0178: Server.CreateObject Access Error

12. Server.CreateObject failure - error ASP 0177 : 800401f3

 

 
Powered by phpBB® Forum Software