zoltan_ie
November 28th, 2003, 11:34 AM
Help!
I'm developing a website and I would like it to use a C# COM. I followed the guide that this lad gave and got it to work.
His post:
Wow, I went off for a few minutes to try this out and all of a sudden there's several answers :-)
Anyway I hadn't tried this before, so thought I'd give it a try. I had no problems whatsoever, so if I tell you what I did, then you can see if it works as per your
I created a Class library and added the following code
using System;
namespace MyNamespace
{
public class MyObject
{
public string MyName()
{
return "I am called MyObject";
}
}
}
I then open project properties and selected the Configuration Properties, build option and set Register for COM interop to True (you can also use regasm or tlbexp and then register the object yourself if you prefer but this option will do all the work for you when you build the DLL).
Okay now I created the ASP
<%
Set obj = Server.CreateObject("MyNamespace.MyObject")
Response.Write(obj.MyName)
Set obj = Nothing
%>
And that's it everything worked first time - cool.
Not sure if this helps you but it appears your TLB is/was not registered, I noticed when I used regasm one time it didn't create the TLBand hence didn't register anything - don't know if you've been using this to create the typelib.
Full post can be found at:
http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_20803202.html
Now my problem came when I want to Debug it. From Visual Studio .NET I place breakpoint in my C# code. I press play ">" and have it setup so that it will start Internet Explorer and go to the URL of the page that will call my COM code.
Now my problem is that my COM/DLL won't Debug.
What do I do? help, help, help!!!
ps. I don't want to use ASP.NET
I'm developing a website and I would like it to use a C# COM. I followed the guide that this lad gave and got it to work.
His post:
Wow, I went off for a few minutes to try this out and all of a sudden there's several answers :-)
Anyway I hadn't tried this before, so thought I'd give it a try. I had no problems whatsoever, so if I tell you what I did, then you can see if it works as per your
I created a Class library and added the following code
using System;
namespace MyNamespace
{
public class MyObject
{
public string MyName()
{
return "I am called MyObject";
}
}
}
I then open project properties and selected the Configuration Properties, build option and set Register for COM interop to True (you can also use regasm or tlbexp and then register the object yourself if you prefer but this option will do all the work for you when you build the DLL).
Okay now I created the ASP
<%
Set obj = Server.CreateObject("MyNamespace.MyObject")
Response.Write(obj.MyName)
Set obj = Nothing
%>
And that's it everything worked first time - cool.
Not sure if this helps you but it appears your TLB is/was not registered, I noticed when I used regasm one time it didn't create the TLBand hence didn't register anything - don't know if you've been using this to create the typelib.
Full post can be found at:
http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_20803202.html
Now my problem came when I want to Debug it. From Visual Studio .NET I place breakpoint in my C# code. I press play ">" and have it setup so that it will start Internet Explorer and go to the URL of the page that will call my COM code.
Now my problem is that my COM/DLL won't Debug.
What do I do? help, help, help!!!
ps. I don't want to use ASP.NET