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

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: