Sunday, October 02, 2005

Calling .NET DLL from Classic ASP Page

I needed to call a .NET DLL from some ASP pages, the DLL was for a search engine and the ASP site was serving as its interface i have done some research and found a way to deal with this the steps are as following:

1- Create a DLL in .NET and be aware that only one class will be used from it (I wasn't able to use any other class than the first one in the dll)

2- build the project

3- Open .NET Command prompt from the tools of .NET located in the Start Menu Shortcuts of .NET

4- Run the following command:
Regasm [Your DLL Path] /codebase

5- in your ASP page create an object from your DLL class
set Inst = Server.CreateObject("NameSpace.ClassName")

replace the NameSpace by your DLL NameSpace and the ClassName by your class name
Note:this code runs in VBScript and it would defer a little if JScript was used

6- You can call a function from your dll using the instance created like:
Inst.CallFunction()

6 comments:

Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.
Oscar said...
This comment has been removed by a blog administrator.
Oscar said...
This comment has been removed by a blog administrator.
Christiaan said...
This comment has been removed by a blog administrator.
dongngh said...
This comment has been removed by a blog administrator.