function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AsterAster 

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?

 

Ady

IspitaIspita

Hi,

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.

mikefitzmikefitz

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

ronaldheftronaldheft

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.