Retrieving the InfoStore object

To query and write to the server, you need to use the InfoStore object (see Creating an InfoStore object). The key to retrieving the InfoStore object is the LogonToken that you saved as a cookie (see Creating a Logon Token). If the Session with the APS has timed out, it is easier to regain access to the Crystal Enterprise system with the LogonToken than supplying the user's logon information. The first thing to check, therefore, is if the cookie actually exists.

Logging on with a Logon Token

Retrieving and checking to see if a cookie exists is possible using the native Request object. The following line retrieves the cookie named LogonToken and checks to ensure that it is not empty.

If( Request.Cookies("LogonToken") <> "" ) Then

If the cookie exists, you should check to see if the InfoStore object exists.If the InfoStore object doesn't exist because your EnterpriseSession with the APS has expired, you can log on with the LogonToken and use the SessionMgr object to create a new EnterpriseSession. Once you have created an EnterpriseSession, you can create and retrieve the InfoStore object.

Example

'Create a session manager.

Set SessionManager = Server.CreateObject("CrystalEnterprise.SessionMgr")

'Logon using the token.  This may fail if the token is no longer valid.

Set Sess = SessionManager.LogonWithToken(LogonToken)

'Create the InfoStore object.

Set IStore = Sess.Service("", "InfoStore")


If the InfoStore object already exists, you can retrieve it directly from the Session where you originally stored it instead of using the LogonToken.

Set IStore = GetSession("IStore")

Go to next step:

Adding the RetrieveIStore function



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