Reputation: 6815
I have a URL as below.
http://editor-sandbox.multiscreensite.com/home/dashboard?stat:339716385fb44bffae0d915cece952b8&dm_sso=2!eyJ2ZXJz
here the url has colon in it (:)
Now I am redirecting the URL as below.
pageRef= new PageReference(aboveURL);
pageRef.setRedirect(true);
return pageRef;
But in browser, it is removing all the url params and final URL in the browser is :
http://editor-sandbox.multiscreensite.com/home/dashboard
How can I retain all the values in the URL including colon?
Upvotes: 1
Views: 856
Reputation: 3300
Colon is a reserved character in URLs (see RFC 3986). Whenever there is a chance that values may have reserved characters, you should urlencode it (this will replace :
with %3A
, !
with %21
, and others if any):
url = 'http://editor-sandbox.multiscreensite.com/home/dashboard?'
+ EncodingUtil.urlEncode('stat:339716385fb44bffae0d915cece952b8,'UTF-8')
+ '&dm_sso='
+ EncodingUtil.urlEncode(2!eyJ2ZXJz','UTF-8');
Upvotes: 1