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
34213421 

redirect url not directing the portal user

I have a VF page on site where I am creating a user and a contact. Upon logging the user in, I wanted the user to be re-directed to an external website instead of site page

I did try this code
 
PageReference pf = Site.login(u.username,password,'custom_login?startURL=%2Fidp%2Flogin%3Fapp%4D0spo000120005Dkg');
                return pf;
          PageReference redirectPage = new PageReference('https%1A%1D%1test.com%1Finteg%1Fsso%1Fgfd.aspx%30%37');
            return redirectPage;

I also tried using start url with ref url as parameter too, but either of them did not work.
Thoughts on this 
Prashant Pandey07Prashant Pandey07
String startUrls='some string';
        Site.login(username, password,startUrls);
       PageReference pr=new PageReference('https://www.google.com');
       return pr;
34213421
Prashant,
I did try that. In this scenario, it is not logging the user in if I try the code , but it is just redirecting the user to the new page(google.com)
Prashant Pandey07Prashant Pandey07
So..What is an external website..I mean how are you relating salesforce to the external website ..if the external website is a salesforce platform ...then you can just pass the url in starturl..
 
34213421
It is not the salesforce platform, but it is an external website through sso. I need a starturl as different and then redirect the user. But for some reason, I do not see that if I use starturl with refUrl appended
Prashant Pandey07Prashant Pandey07
Check once the debug and login history..the user is getting logged in now you just need to get the user id and pass it to next page to maintain the session.

--
Thanks
Prashant
34213421
I do not see the user logged in since, it did redirect me to the signin page of the website. We have the external website integrated through sso of our salesforce platform., But in this case if I use the redirect page, it is not logging the user in
Prashant Pandey07Prashant Pandey07
Not sure about your current setup but if you correctly pass the username and pwd in Site.login() You will get user logged in.