Forum Discussion
David_Stout
Nimbostratus
Dec 17, 2014String Manipulation and TCL Error
I'm up against a wall with my limited iRule knowledge so would like some input here.
We're taking some data within the original URI request and manipulating it into a new format so it's compatible ...
Michael_Jenkins
Cirrostratus
Dec 17, 2014You should be able to use this code instead. You need to parse out the UserId before you can use it. This is one way of doing that (as long as your parameter value is consistent in format). There's other methods of splitting a string to get values, but I think this will work.
set param "accountname=i%3A0%C7%B5%2Et%7Cadfs%20stage%7CIAmAUserName"
log local0. "Query: $param "
set lastpipe [expr [string last "%7C" $param] "3"]
log local0. " Last pipe Index: $lastpipe"
set UserId [string range $query $lastpipe end]
log local0. " Username: $UserId"
set newparam "p%5Bid%5D=i%3A0%C7%B5.t%7Cadfs%7C${UserId}&p%5BidType%5D=adfs"
log local0. " New parameter value: $newparam"
In 11.5+ you can do this
set newquery [string map [list $param $newparam] [HTTP::query]]
log local0. " New Query: $newquery"
HTTP::query $newquery
Otherwise you can do this
set newuri [string map [list $param $newparam] [HTTP::uri]]
log local0. " New URI: $newuri"
HTTP::uri $newuri Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
