2

I am trying to encrypt URL parameters using AMPScript but I have an issue with the encrypted parameters, they include symbols like + or =. So they cannot be used as strings in a URL parameter.

Is there any solution for that? I have tried the encrypting functions in AMPScript but I do not know if there is a way to restrict the encrypted string to a set of chars that does not include special chars.

Edit:

Thanks for the answer but it does not solve the issue. If there are only one parameter and it contains = or ? the amp will not identify the string. Look at the example:

URL

www.whatever.com/?string1=2343?23=

AMPcode in HTML page

%%[ SET @example = Requestparameter ("string1") ]%%
<p> string1: %%=v(@example)=%% </p>

You would expect that the html displayed 2343?23= but it is not displaying anything. You can also try with the string 2342&3234 then the page will display 2342 only. Therefore you can see that one parameter does not solve the problem. Unless I missed something. Anyway thanks.

Edit 2:

The parameter is one of the fields of the subscriber (i.e. email), I encrypt the parameter and I place it in the link. Something like this href="www.whatever.com/%%=v(@example)=%%". Then in the landing page I want to decrypt the parameter and it is there where I have problems if the encrypted parameter contains & or + (not sure if other symbols may also make it not work).

Let me share the code I am using to validate the encryption / decryption works.

%%[ SET @example = Requestparameter ("parametro") ]%%

Parameter: %%=v(@example)=%%

These are some examples of not being able to obtain the complete string in AMP

www.whatever.com/?parametro=23+&24= Then in AMPScript the variable gets the value 23 www.whatever.com/?parametro=2a&der Then there is an error in the code

I know that this is the expected behaviour this is why I am looking for an encryption function that does not generate chars like & or +.

5
  • Is this on a landing page in ExactTarget? I just used http://pages.s6.exacttarget.com/page.aspx?QS=1550dccf35ce5f74eaa21800101bc599579368cf38f97db2&string1=2343?23= and returned string1: 2343?23= on the page. I think we are missing something. What code are you using to encode the url, and how is it being parsed? Jul 29, 2014 at 11:50
  • On a side note - using & in a query parameter is malformed anyhow. You would want to replace those query strings with %26 Jul 29, 2014 at 11:52
  • Then I would have to edit the encrypted string and modify it. What about the symbol + this is also not working right.
    – Dr. Xavier
    Jul 29, 2014 at 12:50
  • You say "it works with + or =" and then say " not able to make it work with & or +. –". does the + work, or no? When do your params get encoded? What code are you using to do that? Jul 29, 2014 at 12:53
  • Sorry for the confusion, it does not work with & and +. This is what I do: In an email template I include an hyperlink, it includes a parameter. The parameter is one of the fields of the subscriber (i.e. email), I encrypt the parameter and I place it in the link. Something like this href="www.whatever.com/%%=v(@example)=%%". Then in the landing page I want to decrypt the parameter and it is there where I have problems if the encrypted parameter contains & or + (not sure if other symbols may also make it not work).
    – Dr. Xavier
    Jul 29, 2014 at 13:27

2 Answers 2

1

Your solution should be fairly straight forward.

When you are creating the link in the email, use URLencode()

href="%%=URLencode(Concat('www.whatever.com/','@example'))=%%"

Give that a shot.

Javier extra info -->

Finally I was able to fix this, thanks Kelly for your tip. The solution is detailed next.

%%[SET @Parameterencoded = URLencode(@parameter,1,1)]%%

%%[SET @finalURL = Concat("www.whatever.com/?fieldname=",@Parameterencoded)]%%

I had to do it like this because encoding the string www.whatever.com/?fieldname= was changing the = and then the final URL was not working.

0
0

Unfortunately, there is no way to pick the characters. There is, however. a workaround; I have done this. Those special characters are only limiting if you have more than one parameter in the query string. I did it like this.

  1. Encrypt the entirety of the parameter string.
  2. Make that new encrypted string the sole parameter in your string.
  3. Use substring/regex (AMPscript) utilities on the destination landing page to get that encrypted string out.
  4. Decrypt and split that string up as needed on the destination LP.

Hope this helps!

0

You must log in to answer this question.

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