devxlogo

Accessing an Existing Instance of an Object in IIS

Accessing an Existing Instance of an Object in IIS

Question:

I have an app exposing a connector class that returns a reference to a single internal global object. This app runs continuously and I want to display status info in an ASP page. When I run code in ASP to do this, it creates a second instance of the EXE. How do I get IIS to use the existing instance?

Answer:

After you create the object the first time, you could place it in the Application Object. The next time you want to access it, retrieve it from the Application object.

Pseudocode:If Application("MyInstance") is Nothing Then   Create the Object   Do what you want with it   Place it in the Application Object    (set Application("MyInstance") = The object)Else   Do what you want with itend if

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist