We are using force.com sites to build a application portal. Customer portal is being used in conjunction to enable self registration.

When a user tries to login ... we are executing the force.com site method like below

PageReference p = Site.login(username, password, '/apex/VF_ApplicantHomePage?Id=005J0000001HVIK');
return p;

However, I get an error when I try to login which says Error: Error occurred while loading a Visualforce page

The URL formed after login action is


Has anyone done the same thing? Can you suggest the work around? Thanks!

2 Answers 2


Can you check once site has access to the VF_ApplicantHomePage , if not add this vf page to sites through

Develop -> Sites-> Force.com Site -> Set Visualforce Page

Even if error also comes, need to check on the permissions on the objects used in the vf page for the profiles used for site login.


I found the issue. The object which the landing page was referring to was not available to the portal. I updated the object properties and was able to redirect succesful login to the landing page

You must log in to answer this question.

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