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
Zach DelongZach Delong 

Site.Login startUrl Ignored

I sent this in to SalesForce support as well but figured I'd ask here after they were unable to resolve the situation quickly.  I am convinced that the solution to this problem must be something simple but it is buried in SalesForce documentation somewhere and I'm too inexperienced with SF to know where to look.  

I'm trying to modify an existing login routine to redirect a user to a resource automatically.  Said another way, if a user bookmarks a particular resource on my site, I want to be able to redirect them to log in, then after succesfully logging in, I want them to be redirected back to the resource they were originally trying to access.  

Here is the code I am working with currently (extremely simple) and a screenshot of a log of the code running.  The relevant parts are highlighted.  
https://www.evernote.com/l/ANz7-J53DQpPP4jUQw_YikXkwM8HmnGBLB0

Here is the relevant documentation that guided me to this solution

https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_sites.htm#apex_System_Site_login
https://help.salesforce.com/apex/HTViewHelpDoc?id=sso_provider_addl_params_start.htm&language=en_US

I'm missing something, because the startUrl appears to be completely ignored.  Users are redirected to log in, the url they came from is logged, and then they are redirected back to the site's "home" page every time.  Thanks for reading!  
Leslie  KismartoniLeslie Kismartoni
Can you try it witout the encoding?
Zach DelongZach Delong
Yep! Without the encoding the same thing happens, the query string (the important part for my site) is still ignored. That was actually the first thing I tried, apologies for not mentioning that!
Michael Alamag 2Michael Alamag 2
>> You'll have to first add the visualfiorce page - "<NAME OF YOUR PAGE>" into the "Site Visualforce Pages" list on the Site Detail page of the site "<NAME OF YOUR SITE>" 

>> Then update the "Active Site Home Page" of "<NAME OF YOUR SITE>" site to "<NAME OF YOUR PAGE>".