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
Sonali GonnadeSonali Gonnade 

How to restrict user from accessing salesforce pages without authentication

Hi,

 

We have created one site on salesforce developer edition. We are using customer portal profile to create user and authenticate users. Now I don't want user to access any visualforce without authentication except home page and login pages. I have tried with all settings like public access setting on site, page setting on profile still facing same problem.

 

If I remove restricted pages from site setting Authorization Required page is displayed but it needs system admin login, I want to change it to customer portal login.

Can anybody help me to resolve this issue

 

Thanks in advance for your help.

 

 Sonali

Best Answer chosen by Admin (Salesforce Developers) 
Ryan-GuestRyan-Guest

Removing the restricted pages is the right thing to do.

 

What you can do is customize the error page that says "Authorization Required" and add your code for portal login on to that page.

All Answers

Ryan-GuestRyan-Guest

Removing the restricted pages is the right thing to do.

 

What you can do is customize the error page that says "Authorization Required" and add your code for portal login on to that page.

This was selected as the best answer
Sonali GonnadeSonali Gonnade

Thanks for your quick help. I tried with the same setting on site still issue is there.

If I am trying to access VF without authentication, custom authentication page is displayed but after successful login also same authentication page is displayed again.

 

Please help.

 

Thanks in advance.

Sonali