+ Start a Discussion

Maintaining Session for Unauthenticated users.

I want to create a public force.com site where the users are not required to be logged in and would use Guest user licenses.

I want to store their selections made on the site for the duration of the session and save the selection in the force.com object.


In most of the earlier posts, I see that there is discussion on maintaining session for logged in users, but there is no information about session management for unauthenticated users.


Is there a way out?





Sessions are maintained in salesforce for logged in users only. Alternatively you can take the database route for saving information to be used as long as the user is in your site and later it can be deleted, but it comes with a storage overhead.

Also use of cookies via javascript would be good option for storing information for the time visitor is on the site.


Hope this helps.


You could use cookies. There is a cookie class in apex that reads and writes cookies and you could destroy them ondemand or when the browser closes.


Good luck


The session is maintained for unauthenticated users as well. If you're seeing a login page after calling an action in your controller, make sure all the fields being accessed are available to the unauthenticated profile.