Community

Post

Regarding Session Handling and Custome User Fields

Hi,

We need clarification on below two items:

We would like to use Session Variables in our application like Session[“<Variable Name>”]. What is the recommended approach to use session Variables in Apprenda Platform. I have looked into SessionContext object of Apprenda and there is no such methods to set and retrieve the session variables. If we use ASP.NET session object, We understand that Apprenda will take care of handling session across the load balanced environment

The applications which we are developing, each application requires some additional fields in the user tables. How to handle this scenario? Is there any way I can extend this functionality to include these additional fields and modify the Apprenda User Creation Screen. We are looking for minimal effort to do this change since we assumed these user management are out of the box support from Apprenda and we are not estimating in our specific project execution.

3 comments

0

Hi Chandru,

You can use Session Variables in your application however this is not recommended, as they will create State in your application. This will cause problems in the case that you plan to scale your application to more than one partition as Apprenda does not handle sessions across machines. By default, Apprenda does provide server affinity, but this is not guaranteed. You can use our Distributed Cache Layer to store information across all servers.

With regards to modifying the User Tables, the best way to approach this scenario would be to extend the OnBoarding screen so that it takes you to a secondary application developed by you, in which additional information can be obtained and stored.

Related to Session: Which API can I use to put it into Distributed Cache? Is this like “UserContext.Instance.Cache.Insert("MyKey", "Chandru", TimeSpan.FromSeconds(1000));” I understand after 1000 seconds, the object in the distributed cache will be automatically removed from Apprenda (like Session expiration)

Related to Modifiying User Tables: Are there any sample implementation exists for this since I didn’t understand properly. You mean to say, in our application we have to create our custom user fields and custom User screen? If you can give us little more detail, it would be helpful

With regards to the Session question, you are correct in using the Cache through Context. You may choose the desired Context level that best fits the usage of your application. For more information, please refer to our documentation page: http://docs.apprenda.com/4-0/caching

With regards to modifying user tables, you can check out the "Contact Manager" sample under the 'Download and Dissect More Samples' section of your Developer Portal Dashboard page. Make sure you deploy it as a Multi-Tenant application when you test it.