Home Search Contact us About us
Title How to Call a COM object from an ASP.
Summary ASP can be a little slow and limited at times. Adding COM objects that are run on the Web Server can speed up things and leverage code written in a varity of language.
Contributor John McTainsh
Published 14-Feb-2001
Last updated 14-Feb-2001
Page rating   66% for 3 votes Useless Brilliant

Description.

COM object are a fast and simple way to add power to a web page. It allows functionality to be added in a verity of languages with very good performance. This simple code sample shows how to do this with a simple COM object.

Here is a sample.

In the code sample a COM object is loaded and the Version parameter is read and displayed 10 times.

<%@ Language=VBScript%>
<html>
<head>
<title>Using COM in ASP</title>
</head>
<body>
<p>Some Text</p>

<%
    set obj = server.createobject("COMSolutions.SolutionReader")
    FOR nLINE = 0 to 10
        %>
        <p>Reading <%=nLINE%> is <%=obj.Version%>.</p>
        <%
    NEXT
%>
</body>
</html>

How to unload the COM object.

Once the COM object file has been loaded it will be kept in memory and can not be replaced until IIS has been stopped. To do this either restart the computer (quite serious) or stop the World Wide Web service. There is also a button on the Internet Services Manager. Select the web site manager properties and open the Home Directory tab. Here there is an Unload button. I have never had any success with this button but it is worth a try.

Comments Date
Home Search Contact us About us