Jump to content

Pass a URL parameter that includes the ampersand (&) character


Recommended Posts

Hi,
My unigui app gets called by following URL: http://myuniguiapp.com/?request_uri=http://domain2.com/?param1=1&param2=2&myuniguiappparam1=1

As you can see, the param "request_uri" represents a URL wtih two params.

var test := UniApplication.Parameters.Values['redirect_uri']

The variable test contains "http://domain2.com/?param1=1".

But i need the whole text of the param "request_uri", includes all params in the url: http://domain2.com/?param1=1&param2=2

ChatGPT says, i have to replace the & char in the param value with %26, somethinl like this: http://myuniguiapp.com/?request_uri=http://domain2.com/?param1=1%26param2=2&myuniguiappparam1=1

But i get the same result in my test variable, param2 is detected as own parameter in UniApplication.Parameters.

Does anybody have a hack for that?

 

Link to comment
Share on other sites

52 minutes ago, Jean-Marc Kiener said:

Hi,
My unigui app gets called by following URL: http://myuniguiapp.com/?request_uri=http://domain2.com/?param1=1&param2=2&myuniguiappparam1=1

As you can see, the param "request_uri" represents a URL wtih two params.

var test := UniApplication.Parameters.Values['redirect_uri']

The variable test contains "http://domain2.com/?param1=1".

But i need the whole text of the param "request_uri", includes all params in the url: http://domain2.com/?param1=1&param2=2

ChatGPT says, i have to replace the & char in the param value with %26, somethinl like this: http://myuniguiapp.com/?request_uri=http://domain2.com/?param1=1%26param2=2&myuniguiappparam1=1

But i get the same result in my test variable, param2 is detected as own parameter in UniApplication.Parameters.

Does anybody have a hack for that?

 

Hello,

1. try solution from here: https://stackoverflow.com/questions/16622504/escaping-ampersand-in-url

or

2. try to send URI as Base64

or 

3. when you get params on server side, try to replace %26 with & and load URI in TStrings (List)

Link to comment
Share on other sites

I already replaced the & with %26 and called my app in a browser with: http://myuniguiapp.com/?request_uri=http://domain2.com/?param1=1%26param2=2&myuniguiappparam1=1

UniApplication.parameters will not recognize it. As result, two parameters are created in uniApplication.parameters.

uniApplication.Parameters.Values['redirect_uri'] = "http://domain2.com/?param1=1"  // here, the second param is not present

uniApplication.parameters.Values['param2'] = 2 // here we find the second parameter as a own parameter. Even if i use a & or %26

uniApplication.parameters.Values['myuniguiappparam1'] = 1  //Correct

 

 

 

 

 

 

Link to comment
Share on other sites

1 hour ago, Jean-Marc Kiener said:

UniApplication.parameters will not recognize it

You can use this:

strVal := UniSession.ARequest.Params.Values['YourParameter'];

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...