Licensing and session handling

In the previous examples, two methods of saving the user's logon state were demonstrated. The first was to store the InfoStore object in a session on the Web Component Server, and the second was to create a LogonToken that allows you to store information in a cookie, instead of on the WCS. These two tasks illustrate two distinct choices that you can make, depending on your performance and scalability needs.

Option 1: Store the InfoStore object on the server

The advantage of storing an Enterprise SDK object, such as the InfoStore, in a session on the WCS is that you will not have to log on every time you need to communicate with the APS; instead, you can retrieve the object from the server and then immediately use it. However, because the object is being stored on the WCS, it uses up space in this server's memory. While retrieving an object that is stored on the server may be efficient for smaller deployments with more limited hardware, if the number of users is very large, the memory requirements may exceed the server's hardware capabilities.

Option 2: Store a Logon Token in a cookie

Instead of storing an object such as the InfoStore on the server, you can create a LogonToken and store it in a cookie. You can then use this token to log on to the APS every time you want to communicate with it. If you decide to log on with a LogonToken, it may take extra calls to retrieve the required object: you must retrieve an EnterpriseSession by logging on with the token, retrieve an InfoStore object, and then use it for something such as querying. Additionally, if you have a limited number of licenses for Crystal Enterprise, logging on with a LogonToken may be a poor choice since a user that is between pages may lose his or her license before loading the next page. See the note below regarding licensing.

You may choose one of these options over the other, or you may wish to apply both of them. In this tutorial, the above two options have been combined.

Note:    No matter which option you choose, each user that is logged on to the server, whether it be by using a token or not, will use a license. The license will only be freed for use by another user once the user has no more open sessions, regardless of how they were created. If you have a valid Enterprise SDK object that was retrieved from an EnterpriseSession either directly or indirectly, then the session will still be considered open. All references to the session must be removed before it is finally closed. If a user still has a valid session, the license is still being used. You must destroy the EnterpriseSession before the license is released. For information on doing this, see Lesson 4: Logging off and freeing licenses.

Go to next step:

Redirecting the user to the site's home page



Crystal Decisions, Inc.
http://www.crystaldecisions.com
Support services:
http://support.crystaldecisions.com