Facebook Twitter Reddit LinkedIn

ASP tip () vs. Server.CreateObject())

When creating a server object using a server component, you have a choice between two methods. The most common method is to use the CreateObject() method of the Server object, as shown in the following code:

SET NextLink = Server.CreateObject("MSWC.NextLink")

While this method works fine, there is another way to create an object that is just a bit more resource friendly.When you create an object using the Server.CreateObject() method, the object is created as soon as the method is called. Any threads, memory, or other resources are allocated at the point of instantiation, or creation. The syntax for creating an object using the <OBJECT> tag is shown in the following statement:

<OBJECT Runat=Sever ID=NextLink ProgID="MSWC.NextLink"></OBJECT>

By using the HTML <OBJECT> tag with the Runat=Server attribute, you can create the object in a way that it is not actually created until the first method or property of the new object is referenced.

While this may not seem like a lot of savings, when you are trying to design a system that can withstand 1,000,000 hits per day, every little bit helps.

Source: Anonymous

© 2007-2019 All rights reserved.   Part of the somuch.com group of trusted web sites.   PO Box 351031, Palm Coast FL 32135-1031