Link to home
Create AccountLog in
Avatar of JohannRamon
JohannRamonFlag for Colombia

asked on

How to instantiate a COM in an ASP application?

Hi:

How can i instantiate a COM object for a whole ASP application? In Visual Studio 6.0 i used to have a global.asa file with a couple of lines like this:

<OBJECT RUNAT=Server SCOPE=Session ID=objPacket PROGID="CN.Packet.3.2">
</OBJECT>

This way i was able to "use" the COM from any page of application with code like this:

d = objPacket.UnpackDouble();

However in Visual Studio 2005 it doesn't work :( How can i do this?

Thanks,

Johann
Avatar of ZachSmith
ZachSmith
Flag of United States of America image

You need to reference the COM object using Visual Studio. Right click the Project, go to "Add Reference", and then choose the "COM" tab. Find the object you want to reference and a interop object will be created that you can use to interact with the COM object from ASP.NET
Avatar of JohannRamon

ASKER

Thanks ZachSmith:

And how can i write the code to call it in the ASP? The reasons because I need to have it instantiated for the whole application (at session level) are:

- It has to be different for every single user.
- It has to be the same for the same user (session).

Thanks again and regards,

Johann
ASKER CERTIFIED SOLUTION
Avatar of ZachSmith
ZachSmith
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account