Is it possible, I have a dll i create it in c#, can i call this dll in vbscript or asp and if possible how?
C# DLL
6 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Is it possible, I have a dll i create it in c#, can i call this dll in vbscript or asp and if possible how?
Know the answer? Post it. Somebody with the same question will find it here.
corey7 pointsPosted Jun 3, 2007, 8:21 PM EDT
reference...
using System.Runtime.InteropServices;
//after the namepace name
[ComVisible(true), ProgId("YourClass.Application")]
just do a....in vbscript or asp
set objMydll = CreateObject("YourClass.Application")
richard lim23 pointsPosted Jun 5, 2007, 2:00 AM EDT
My c# dll name is clsFunc.dll
No display in my page what seems to be the error?
<SCRIPT LANGUAGE="vbscript" runat="server">
Dim obj,strSend
Set obj = Server.CreateObject("clsFunc.Class1")
strSend = "Add - " & obj.PerformAddition(15, 9) & vbCrLf & "Minus - " & obj.PerformSubtraction(114, 10)
Msgbox strSend
</SCRIPT>
Mike GoldRank #50 · 30.6K pointsPosted Jun 20, 2007, 11:11 AM EDT
Best,
richard lim23 pointsPosted Jun 20, 2007, 6:23 PM EDT
Server object error 'ASP 0177 : 800401f3'
Server.CreateObject Failed
/xotrack_testsite/polo4050/mytest/testme.asp, line 11
800401f3
Above is the error in my internet explorer below is my c# dll code kindly check pls. tnx.
using System;
using System.Collections.Generic;
using System.Text;
using System.EnterpriseServices;
using System.Runtime.InteropServices;
[assembly: ApplicationAccessControl(true)]
namespace clsFunc
{
[Guid("5C63A021-EDEF-4044-B9DE-93036C5FCDD9")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface iInterface
{
[DispId(1)]
int PerformAddition(int a, int b);
int PerformSubtraction(int a, int b);
}
[ProgId("clsFunc.Class1")]
[ClassInterface(ClassInterfaceType.None)]
public class Class1 : ServicedComponent, iInterface
{
public int PerformAddition(int a, int b)
{
try
{
return a + b;
}
catch
{
return 0;
}
}
public int PerformSubtraction(int a, int b)
{
try
{
return a - b;
}
catch
{
return 0;
}
}
}
}
Mike GoldRank #50 · 30.6K pointsPosted Jun 20, 2007, 7:42 PM EDT
richard lim23 pointsPosted Jun 20, 2007, 7:53 PM EDT
I already read your article it helps, i already registered my dll in my computer maybe the problem is in the server maybe what i need to do is to remotely registered it in the server any idea.
Thank you very much.