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
PotaPota 

Logging out of the Current User in Salesforce Custom Site?

Hi All,

 

I am trying to Logout current User in Custom Salesforce sites....but i am getting this error:  

 

"java.lang.IllegalArgumentException: Illegal view ID null/Logout. The ID must begin with /"

 

My Code is :

 

In VF page

<apex:page action="{!logoutCurrentUser}"  controller="SiteLoginController" standardStylesheets="false" title="Login" showHeader="false" sidebar="false">

 

and Controller:

 

public PageReference logoutCurrentUser(){
return UserInfo.getUserType() != 'Guest' ? new PageReference(Site.getCurrentSiteUrl() + '/Logout') : null ;
 }

 

Can any one help me out of this?

 

 

Thanks in advance  :)

 

Vinit_KumarVinit_Kumar

Pota,

 

Change your code from

 

return UserInfo.getUserType() != 'Guest' ? new PageReference(Site.getCurrentSiteUrl() + '/Logout') : null ;

 

to

 

return UserInfo.getUserType() != 'Guest' ? new PageReference( '/secur/logout.jsp') : null ;

PotaPota

Hi Vinit,

 

Thanks for ur reply..

 

But...when ever the user clicks directly Logout button..this works fine without any problem.My problem is without clicking Logout button user directly closes the tab and open this site in another tab with same USERNAME and PWD.That time the session is not killed.So..i am getting the following error.

 

"

Error: Error occurred while loading a Visualforce page. 

"

How can i killed out this type of sessions?(through programming)?

 

Can u pls have a look?

Vinit_KumarVinit_Kumar

Agreed with you,if a VF session is already there it would not allow you to create a new session as VF session are bound to particular key on post request.

 

I think there is a perm which can be disabled which would kill the session if you close the browser,but you need to check with salesforce support for that ,not too sure.