0

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...

Thanks.

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

1 Answer 1

0

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.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .