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
voutchervoutcher 

How to create a logout button!

Logging in to the customer portal is easy, just redirect to the page and force.com does the rest.

 

But, I can't find any way of logging out! Checked the forums, documentation etc.

 

Any ideas? Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
BulentBulent

You have the example as part of the sample header component:

 

 

<apex:outputLink value="{!$Site.Prefix}/secur/logout.jsp" rendered="{!NOT(ISPICKVAL($User.UserType,'Guest'))}">{!$Label.site.logout}</apex:outputLink>

 

Also, make sure you populate the Logout URL field for your portal if you want to take users to a page other than the site home page after logout (on the portal details page)

 

 

All Answers

BulentBulent

You have the example as part of the sample header component:

 

 

<apex:outputLink value="{!$Site.Prefix}/secur/logout.jsp" rendered="{!NOT(ISPICKVAL($User.UserType,'Guest'))}">{!$Label.site.logout}</apex:outputLink>

 

Also, make sure you populate the Logout URL field for your portal if you want to take users to a page other than the site home page after logout (on the portal details page)

 

 

This was selected as the best answer
voutchervoutcher

Also nice a simple. :-)

 

Thanks for the quick response.