Using Page.Session to store values in the SalesLogix web client

The Page.Session object in ASP.NET allows you to save data per user that requests a page from the SalesLogix web client application.  Variables stored in the session object are not discarded when users move between pages.  The variables will persist for the length of time the user is in the SalesLogix web client, or until a session timeout occurs.


To create a session variable you can use the following syntax:

Sage.Entity.Interfaces.IAccount account = this.BindingSource.Current as Sage.Entity.Interfaces.IAccount;

Page.Session["AccountName"] = account.Account;

Then to retrieve the variable you can use the following:

if (Page.Session["AccountName"].ToString() == "Abbott Worldwide")
    //do something

Be aware that the system will not throw an error if you try to retrieve a variable that is not in the session object. So you should test for the existence first like so:

if(Page.Session["AccountName"] == null) //the variable does not exists, do something

For more on the Session State object check out this MSDN article

Want content like this delivered to your inbox? Sign up for our newsletter!

Kris Halsrud

Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.

Submit a Comment

Your email address will not be published. Required fields are marked *