I was trying to fix a defect for a VF page for Site.com. Originally after the portal user log in to the Site it will be direct to changePassword page. I made a fix to that changePassword page and changed the version of the controller from 26.0 to 30.0. After that, it seems I can't even go into that page. After trying to log in, it will prompt an exception page telling me that and Error occurred while loading a Visualforce page. I tried to get the debug log of that user but it doesn't seem the log is generated - so it seems to me that the login process was not even completed. I changed the version back and changed my code back but it still shows the same error. I checked the permissions, pages of the Site which seems to be right. I am quite lost now. Any thoughts?

Update: I just tried to try the url of changePassword after login and saw the exception page - and I am able to see that page, which means the user is already logged in. But I still can't see any log generated. Any thoughts about why?

  • Log in with the same user in salesforce and type in the URL /apex/changePassword, there you should be able to see the actual error rather the exception page. Commented Jun 5, 2014 at 6:00
  • @Bachovski That user is actually a portal user which doesn't have access to Salesforce. And the site is only open to portal users. Anyway, I have figured out part of the issue now. Now when I use the site with https:// it works fine. But I still get the error when using http://
    – Lance Shi
    Commented Jun 5, 2014 at 6:07
  • So what is the problem at this stage when you use HTTPS? Commented Jun 5, 2014 at 6:09
  • There were two issues: 1, the site took a self-defined VF page as the home page and used hard-coded org ID and url; 2, still the permission, the VF page used some fields of contact but the permission to contact was not assigned to that profile.
    – Lance Shi
    Commented Jun 5, 2014 at 6:48
  • Did you open logs for the site user?
    – tugce
    Commented Dec 1, 2016 at 7:21

2 Answers 2


As on Force.com site normally we see the error like below image, enter image description here

which is difficult to understand and not user friendly, however we can define a custom error page to catch the exceptions , so that when ever an error occurrs it will get redirect to our custom visualforce error page and will displays the actual error message.

  1. Create a custom VF page and Controller and write a PageLevel Action.

  2. There are two methods available in Force.com sites i.$Site.ErrorMessage ii. $Site.ErrorDescription

  3. In Controller write a method to catch exception using above method.

  4. There standard error pages already available in Community setttings, replace these VF pages in Community settings with custom VF page for error message. For more details please refer https://help.salesforce.com/articleView?id=sites_error_pages.htm&type=0 for replacing standard error pages. That's it, now whenever an exception occurred you will get the details on your custom error page.

VF Page:

<apex:page action="{!yourPageLevelAction}" controller="YourController" >
<apex:outputText styleClass="title" value="{!failingPageResponse}">    </apex:outputText>


public  class YourController {
    //Variable Declaration
    public String failingPageResponse { get; set; }

    public PageReference yourPageLevelAction()
        failingPageResponse = Site.getErrorDescription();

Using this you will get idea about what is going wrong and probably that will help you to mitigate your issue.



In Apex pages for sites, there should be an error page. If you add the output field tag with $site.errordescription, to the error visual force page, then you would see the error in detail.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .