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
JK84JK84 

Control users page access in site

Hi,

 

I have a site which displays a welcome page first, with 2 buttons to either sign up as a new user and search for existing user details.

 

When search button is clicked, the user is asked to enter few details which are validated and only if he is allowed to search the search options page is displayed.

 

Now,  how do I restrict the user from directly accessing the search options page? If someone knows the URL of the search options page, there could be chance of accessing the page directly without going through the normal flow.

 

Do I have to use the referrer URL or is there any way built in force.com sites which restricts users from directly acessing the pages in a random order.

Best Answer chosen by Admin (Salesforce Developers) 
Vinita_SFDCVinita_SFDC

Hi,

 

As per standard functionality, after login it will take you to the page3.

 

Try setting up a variable in first page like flag=true and this will carry over to page2 & page3 by maintaining session and on page2 & page3 check if the flag is set to true, then only show the page else redirect it to Page1.

 

So whenever user will hit page3 directly the value of the flag will be false and it will redirect to landing page that is page1.

All Answers

Vinita_SFDCVinita_SFDC

Hi,

 

Is that search page is a custom VF page? If yes do not provide access to this page on user's profile and for the existing users you can create a permission set where you can provide access to this VF page.

JK84JK84
Thanks Vinita. The VF pages are part of a site, so all the users of the site access it through the Guest profile. The question was that site has page1, page2, page3 and I don't want users to be able to access page3 directly, instead page3 should only be accessible when traversed through page1 and page2. For now I've used Referrer URL to find out the page from which user has landed into Page3, but wanted to know if there is any better way out provided by force.com out of the box.
Vinita_SFDCVinita_SFDC

Hi,

 

As per standard functionality, after login it will take you to the page3.

 

Try setting up a variable in first page like flag=true and this will carry over to page2 & page3 by maintaining session and on page2 & page3 check if the flag is set to true, then only show the page else redirect it to Page1.

 

So whenever user will hit page3 directly the value of the flag will be false and it will redirect to landing page that is page1.

This was selected as the best answer