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
sfdcdev.ax551sfdcdev.ax551 

URLEncoding issue with Visualforce

Hi,

 

I had a question on URL Encoding.

 

Scenario:

End users would be getting specific hyperlinks in their emails/newsletters. The HREF information in those links will be something like this: 

https://csx.salesforce.com/secur/login_portal.jsp?orgId=xxxxxxxxx&portalId=xxxxxxxxxxxxx&startURL=/apex/firstPage?stURLcustom=http://xxxxx.xxxxcom/xxxx/xxx.cfm?ui=sso&a=one&id_subject=xxxx&defaultlanguage=1  

 

When user clicks on the above link, it will try to first login the user to partner portal and then based on the salesforce's “startURL” parameter, it will redirect them to the VF page named “firstPage”. It is in this VF page where I need to retrieve the full query string for the second sub-query-string parameter “stURLcustom”. The value that I get for stURLcustom should be the entire string as shown below:

http://xxxxx.xxxxcom/xxxx/xxx.cfm?ui=sso&a=one&id_subject=xxxx&defaultlanguage=1

 

Issue:
We do not have control on the HREF values behind the custom links as they are sent by other systems outside of Salesforce. Right now the issue is that when I click the link above, I go to the PRM login page and once I enter a valid login and password, it takes me to the visualforce page based on the startURL parameter;  but the document URL on this page is displayed as follows: 

https://csx.salesforce.com/secur/login_portal.jsp?orgId=xxxxxxxxx&portalId=xxxxxxxxxxxxx&startURL=/apex/firstPage?stURLcustom=http://xxxxx.xxxxcom/xxxx/xxx.cfm?ui=sso  

Instead of: 

https://csx.salesforce.com/secur/login_portal.jsp?orgId=xxxxxxxxx&portalId=xxxxxxxxxxxxx&startURL=/apex/firstPage?stURLcustom=http://xxxxx.xxxxcom/xxxx/xxx.cfm?ui=sso&a=one&id_subject=xxxx&defaultlanguage=1

 

We cannot use the URLEncoding utility available in Apex, as we need to implement this without a controller. I tried encoding the whole URL with UTF 8  but that did not work either and was throwing an invald URL error.

 

Any thoughts on how can I get the full query String URL for the parameter stURLcustom for the above scenario? 

 

Thanks for your time.

 

Thanks