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
RameshkannanRameshkannan Sites - Login Page - not redirecting.


Hi all,

Please check the code and reply me .

The problem is after user login to the site . it should be redirected to " hpage"(vf page which will act as a homepage)

In this case , i couldnot be able to redirect to that page.

genius pls help me out .

Code below :

global class LoginController {
    global String username {get; set;}
    global String password {get; set;}

    global PageReference login() {
        String startUrl = System.currentPageReference().getParameters().get('');
        return Site.login(username, password,'');
        global LoginController () {}
    global static testMethod void testSiteLoginController () {
        // Instantiate a new controller with all parameters in the page
        SiteLoginController controller = new SiteLoginController ();
        controller.username = '';
        controller.password = '123456'; 

Whether the format of the start url is correct ?


Change this line:


return Site.login(username, password,' n?StartURL=/Welcomepage/hpage');


to say this:


return Site.login(username, password,'/hpage');

Can you please tell me , who are all can use the sites. Only the user with authenticated website licence can access the sites ?


 I mean to say only the customer portal users or authenticated website users  can access and not a  normal user ?


please post the login page code for the reference.


Please provide me with the details.







Normal users can never use Sites.


Portal users: Customer Portal (customer portal, high volume portal user, authenticated website user) or Partner Portal (partner) can access sites.


If you want these users to be able to use your site, you'll need to associate the portal with the site under the "Login Settings" section of the Site setup page. You'll notice on this page that only a single portal can be associated with a site at one time. So if you create a customer portal and associate it with a site - only this portal will be able to login to your site.


Thanks ryan.



Can you please give me the code for save button ie. {!save } and login page.


After clicking the save  button it should not show the default page( ie.saved record page). it needs to be navigated to another visual force page which i create.


Example : if i click submit button. it needs to be navigated to another page ,in which it should show " thanks for registering".


the same is applicable to the login page also . after clicking the button it needs to be navigated to the home page.


please help me .





Hey Ryan that means we cannot pass more than 1 parameter to the StartUrl. I have a requirement wherein I have to pass more than 1 parameter. But it seems that the part after the 1st parameter is lost and never considered. Is there a workaround..