
390
|
Chapter 18: The HttpServerUtility Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
6. This can have a significant negative impact on performance, so be sure to test
your application carefully to determine whether the performance will be accept-
able when using this attribute.
In ASP.NET, unlike in ASP, it isn’t necessary to use the
Set keyword with
CreateObject, as shown in the previous example. It also isn’t necessary to use
Set
objName = Nothing
to release the reference to the object, since the managed refer-
ence is eventually garbage collected, at which point the COM object is
dereferenced and destroyed.
CreateObjectFromClsid
objvar = Server.CreateObjectFromClsid(Clsid)
Returns a reference to a COM object created based on the supplied COM CLSID.
Parameters
objvar
A variable of type Object to receive the reference to the newly created object.
Clsid
A String variable or literal containing the COM CLSID (a type of globally
unique identifier (GUID) for the component that is found in the Registry) of
the desired object.
Example
The code example declares an object variable, uses Server.CreateObject-
FromClsid to assign a reference to a newly created ADO Recordset object to the
variable, and then opens the recordset and returns the RecordCount property to
the browser using the Message label control.
Sub Page_Load( )
Dim rs1
Dim ConnString ...