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
Derek M HughesDerek M Hughes 

Generic Error Page not displayed to Site Guest User

This may be a limitation but I would like to confirm that OR find an alternative solution.

I have created a Visualforce page to be used as the Generic Error Page in my site.  However, when an error occurs on the site while being viewed by a Site Guest User instead of displaying my error page the "Authorization Required Page (401)" is displayed.

When a user is logged in (such as then the site is used for a community) then the correct generic error page is displayed.

The same actaully happens when using the default "Exception" page so it is not related to my own Visualforce error page.

Is this a limitation?  Can generic error page only be displayed to logged in users?  If so, any ideas on how to create a similar experience for guest users?

Thanks in advance.
 

Derek 

surya kanadhipatlasurya kanadhipatla
Derek ,
Please add this VF page in site settings.

Please see below to add:

http://salesforce.stackexchange.com/questions/17419/adding-visualforce-page-to-sites
Derek M HughesDerek M Hughes
HI, Thanks for the suggestion. I had already check that both the standard “Exception” page and my new Visualforce page are added to the site settings. Regards Derek
surya kanadhipatlasurya kanadhipatla
Thanks for the reply Derek, can you confirm if your VF page controller uses with sharing Keyword? and also can you send a screenshot where VF page is added under Site Visualforce Pages as below? [image: Inline image 1]
surya kanadhipatlasurya kanadhipatla
It seems image broke:

here it is :

VF
Derek M HughesDerek M Hughes
Hi,

My controller for the bsas_error page does not use "with sharing".  I have tried to add "with sharing" and the problem is the same.  THis also happens with the standard "Exception" page that does not have a controller at all.

My page be viewed in the site if you enter its URL directly:  https://sandbox-cloudsmiths.cs81.force.com/barclays/bsas_error as can the standard exception page https://sandbox-cloudsmiths.cs81.force.com/barclays/exception 

Its only when an exception occurs that the login page is displayed instead of the error page.

See screenshot as requested

User-added image

Regards
Derek


 
surya kanadhipatlasurya kanadhipatla
Thanks Derek, Agreed , Can you try Without sharing key word for the controller explicitly and see if the error is same?
Derek M HughesDerek M Hughes
I have now tried both "with sharing" and "without sharing" on the controller class.  Same behaviour. The error page will not display when there is not a logged in user.  When a user is logged it then it displays correctly.
surya kanadhipatlasurya kanadhipatla
Derek, Sorry to hear that it still not working, My last try :) below. 1. Have you added controller class to site settings(Enabled apex class Access section) or only a VF page? [image: Inline image 1] 2. Please refer the below links for other site settings if any thing is missed. https://developer.salesforce.com/forums/?id=906F000000099U4IAI https://developer.salesforce.com/forums/#!/feedtype=SINGLE_QUESTION_DETAIL&dc=Mobile&criteria=ALLQUESTIONS&id=906F0000000AZYGIA4