Interviewer - Server Admin > Customizing UNICOM Intelligence Interviewer - Server Admin > Adding activities to UNICOM Intelligence Interviewer - Server Admin > Common tasks in activity development > Supporting application session monitoring
 
Supporting application session monitoring
For the standard UNICOM Intelligence Interviewer - Server Admin activities, UNICOM Intelligence Interviewer - Server Admin automatically maintains a history of application sessions. An application session is the period in which a UNICOM Intelligence Interviewer - Server Admin user has a particular activity open. This information is stored in two tables in the mrUserData database:
ApplicationSession
This table contains one row for every current application session in the UNICOM Intelligence Interviewer - Server Admin system.
ApplicationSessionHistory
This table contains one row for every past application session in the UNICOM Intelligence Interviewer - Server Admin system.
Note UNICOM Intelligence Interviewer - Server Admin does not include any reports for querying the data in those tables. To do this, you must write your own SQL queries and reports.
If you want your activity to be included in those two tables, make sure that the activity supports the UNICOM Intelligence Interviewer - Server Admin application session monitoring feature. To do this, the application needs to use UNICOM Intelligence Interviewer - Server Admin Application Framework: see Using the UNICOM Intelligence Interviewer - Server Admin Application Framework.
If you create the activity using the UNICOM Intelligence Interviewer - Server Admin application wizard, it automatically supports application session monitoring and no further changes are required. In all other cases, follow the steps below. (See also Using the UNICOM Intelligence Interviewer - Server Admin wizards.)
To support application session monitoring
1 Make sure that the ApplicationInit.aspx page derives from the SPSSMR.Web.UI.AppPage class. This ensures that application session monitoring is started when your activity is opened.
2 Add a Global.asax file to your application if it does not already have one.
3 In Global.asax, create a class that is derived from SPSSMR.Web.HttpApplication and add Application_Start and Session_End event handlers to the class.
4 In the Application_Start event handler, add the following key/value pairs to the System.Web.HttpApplication.Application object:
Key
Value
Name
A string containing the name of your activity
AllowApplicationMonitoring
True
Here is an example, written in C#:
protected void Application_Start(Object sender, EventArgs e)
{
  Application["Name"] = "MyDimensionNetActivity";
  Application["AllowApplicationMonitoring"] = True;
}
5 In the Session_End event handler, call the SPSSMR.Web.HttpApplication.StopSession() method. Here is an example, written in C#:
protected void Session_End(Object sender, EventArgs e)
{
  StopSession();
}
6 Whenever you close your application, such as in a menu option, make sure that you call the SPSSMR.Web.UI.AppPage.StopSession() method before you redirect to the UNICOM Intelligence Interviewer - Server Admin home page. Here is an example, written in C#:
this.StopSession();
// Now redirect to UNICOM Intelligence Interviewer - Server Admin...
...
However, if your page does not derive from SPSSMR.Web.UI.AppPage, you must create a session object so that you can then call the StopSession() method. Here is an example, written in C#:
using SPSSMR.Management.Monitoring.DimensionNet.Sessions;
...
if (this.Session != null)
{
  ApplicationSession appSession = (ApplicationSession) Session ["ApplicationSession"];
  if (appSession != null)
    appSession.StopSession();
}
To use the ApplicationSession class, you must add to your project a reference to the assembly file SPSSMR.Management.Monitoring.DimensionNet.dll , which by default is located in:
C:Program FilesCommon FilesIBMSPSSDataCollection7Server Admin
Calling the StopSession() method in all your exit routines produces more accurate statistics than relying on the Session_End event handler to stop application session monitoring, because that event is typically raised 20 minutes after the user closes the activity.
See also
UNICOM Intelligence Interviewer - Server Admin audit trail
Common tasks in activity development