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
DianeMDianeM 

How do I open customer portal from sites

I have a public facing website that is built on Sites.  This site supports guest users to collect information and requests.  I have also created a customer portal and set the appropriate permissions in the customer portal and the site.  

 

From my public site I would like to support a Login button.  The login collects the user and password and after successful login I would like the customer portal to open.  I have used the SiteLogin example and code and I am able to successfully login using my Login button in the public facing site.  But I can't get the customer portal to open.  

 

After the login, the home page of my site opens.  Does anyone have an idea how I can get the portal to open.

 

Thanks,

 

Diane

Best Answer chosen by Admin (Salesforce Developers) 
aalbertaalbert

Are you using the Site.Login() apex method to authenticate the user? The 3rd parameter, loginURL, is the url to redirect the user to upon successful login. If you want it to the redirect to the standard portal home page, specify something like '/home/home.jsp'. If you have a custom visualforce page configured in the customer portal, you can specify that by setting the loginURL = '/apex/visualforcepage_name_here'.

 

 

All Answers

aalbertaalbert

Are you using the Site.Login() apex method to authenticate the user? The 3rd parameter, loginURL, is the url to redirect the user to upon successful login. If you want it to the redirect to the standard portal home page, specify something like '/home/home.jsp'. If you have a custom visualforce page configured in the customer portal, you can specify that by setting the loginURL = '/apex/visualforcepage_name_here'.

 

 

This was selected as the best answer
DianeMDianeM

Thank you - I did try that and there was a slight delay and then I was redirected to the home page on the web site again.  Are there some parameters that need to be set - I wouldn't think so since I am already logged in but maybe - I see a reference to orgid and portal id in the portal login.

aalbertaalbert

What do you have the 'starturl' parameter set to in Site.login()? 

DianeMDianeM

I was missing the leading '/'.  Now that I have addde that it is working exactly the way I want it to.

 

 

PageReference retPage = Site.login(username, password, '/home/home.jsp');

 

 

Thanks for the help.

 

Diane