You need to sign in to do that
Don't have an account?

How to maintain User login session throughout the application..
Hi,
We have created one sample application using force.com which having user login page with user authentication. The user should not access any other pages without authentication and after successful login user session should be maintain throughout the application.
Is there any method or parameter which will help to maintain user session.
Is there something about the automatic page redirection to the login page if users are not authenticated?
Kindly assist.
Thanks in advance.
I will give you my approach of doing things , thoughthis can be done in various ways.
I would suggest you implement the session maintenance via custom settings . The moment someone logs in create an instance of custom setting pair say (Id, email, timestmp, random number).
Now whenever the users logs out you will destroy or delete this instance of record.
But as the user is logged in and tries to navigate to other page you send the timestamp and email (this has to be unique as I used this field for unique identification ), via URL and check on the landing page's load event if the email is present as an instance in custom settings if yes allow navigation , if not ask to log in .
Also if you want to implement login to expire after say x hours you find the difference between timestamp in custom setting and the current timestamp and if it is greater than x hours , ask the user to login again.
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Thanks a lot for your quick response.
I will try with this approach and in case of any problem let you know.
Thanks
Sonali Gonnade
Hi,
I am little bit confused about implementing the custom setting for session maintenance.
It would be great if you give one sample example for the same.
Thanks in advance for your help.
Sonali
Please provide some steps /sample example for custom setting to maintain session.
It would be really helpful for our application.
Thanks
Sonali
Hi, the above post is with regard to the logged in user.
What if I want to create a public Force.com site with unauthenticated user access and still maintan the session throughout the user's browsing session?
i.e. if the users visits the public site and makes some selection, it shoudl be stored in a session till the user closes the browser/browser tab. Since this user is not logged in, we do not know any information about the user and we'll not be able to track the user after the browser closes.
Any thoughts on this?
Ady
Registering a Site domain and Maintaining a Session
For all those people who want to register and free force.com site and maintain a session for users, I request you to first create a fresh developer.force.com account even if you have one and follow the following steps.
WORDS OF WISDOM
Instead of finding out why the problem is occurring in your existing portal and debugging it, create a new one and copy all your objects through workbench(If you don't know how to do this, share your email id and I will mail you the ppt to transfer objects from one salesforce account to another), copy and paste visualforce pages and apex classes to your new force.com account.
STEPS
Registering a Site domain and Maintaining a Session
For all those people who want to register and free force.com site and maintain a session for users, I request you to first create a fresh developer.force.com account even if you have one and follow the following steps.
WORDS OF WISDOM
Instead of finding out why the problem is occurring in your existing portal and debugging it, create a new one and copy all your objects through workbench, copy and paste visualforce pages and apex classes to your new force.com account.
STEPS