I have written a VF Page which redirects to standard record creation page based on some condition But actually its not.

I have found that there were spaces in the parameter included in the page reference.

I got the below Error when there is space in the page reference parameter.

**Invalid Page Redirection

The page you attempted to access has been blocked due to a redirection to an outside website or an improperly coded link or button. Please contact your salesforce.com Administrator for assistance. For more information, see Insufficient Privileges Errors. Click here to return to the previous page.**

Please help me...


  • What is the URL you're trying to redirect to? – Matt Lacey Jun 25 '15 at 8:18

It sounds like you need to URL encode the parameter to make it safe to use. Before using the parameter's value in the page reference run it through the urlEncode method:

String encodedParameter = EncodingUtil.urlEncode(theParameter, 'UTF-8');

That will replace any spaces with the appropriate HTML encoded value "%20" and cover off other special characters as well.

  • Thanks for your Reply But, still getting the same error. – Srinivas Jun 25 '15 at 8:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.