Writing Your Own C# .NET Application

  1. Create a Visual C# Project choosing ASP.NET Web Application.

  2. Click Project->Add Reference... to display the Add Reference dialogue box. Click the COM tab and then select PASSPORT Host Integration Objects, choose Select and then OK. PASSHIOLib will be added to the References under the Web Application.

  3. In the Global.asax source code page, add the following code to Application_Start to create a Sessions object in Application level:

    protected void Application_Start(Object sender, EventArgs e)
    {

PASSHIOLib.IOhioSessions MFSessions;

MFSessions = new PASSHIOLib.OhioSessionsClass();
Application["MFSessions"] = MFSessions;

}

  1. You can access the Sessions object by using Application["MFSessions"], for example:

PASSHIOLib.IOhioSessions objSessions;
objSessions = (PASSHIOLib.IOhioSessions)(Application["MFSessions"]);

  1. Use the AddSession method of the Sessions object to create a Session object, for example:

PASSHIOLib.IOhioSession  objSession;
objSession = objSessions.AddSession ("C:\\Inetpub\\wwwroot\\WAHIO\\locis.zcc", 0);
objSession.Connect();

  1. After successfully creating a Session object, connect the host session using the Connect method or call other methods or properties to access the host session, for example:

PASSHIOLib.IOhioScreen   objScreen;
objSession.Connect();
objScreen = objSession.Screen;

  1. When finished with the session, you need to call the CloseSession method of the Sessions object to release the session.

  2. Use Marshal.ReleaseComObject to force the Session object to be released from memory and thus recover the license count. If this is not done, your application will eventually use up all available licensed sessions, and not be able to start any additional host sessions.