Forum Discussion
XML Dump of all Session Variables
I am looking for a way to spit back out all my session variables dynamically. For now I just have some I can anticipate. For example:
when HTTP_REQUEST {
if {[HTTP::cookie exists MRHSession]} {
set MRHSession [HTTP::cookie value MRHSession]
if { [HTTP::uri] == "/whoami" } {
set apmsessionid [ACCESS::session data get "session.user.sessionid"]
set apmsessionuser [ACCESS::session data get "session.logon.last.username"]
set apmsessionlanding [ACCESS::session data get "session.server.landinguri"]
set apmsessiondomain [ACCESS::session data get "session.ad.last.actualdomain"]
set htmlStream "\r\n\r\n\t\r\n\t\t$apmsessionid\r\n\t\t$apmsessionuser\r\n\t\t$apmsessionlanding\r\n\t$apmsessiondomain\r\n\t\r\n\r\n\r\n"
HTTP::respond 200 content $htmlStream "Content-Type" "text/xml" "Cache-Control" "no-cache, must-revalidate"
}
}
}
But my example is only getting explicit variables in the session, and then manually creating and spitting out the XML for it. Is there a method by which I can either a.) receive all the variables so I can loop through them building the XML stream, or b.) is there just a really neat function that will produce the XML output for me all together?
Anyone ever tried this yet or have an idea on where to get started?
3 Replies
- Clint_124473
Nimbostratus
[Deleted]
- Kevin_Stewart
Employee
Unfortunately there's no way (currently) to enumerate session variables within an iRule without knowing their specific name. You could, however, create a data group of all known session variables and simply loop through those in your iRule. - Clint_124473
Nimbostratus
Yeah. That's where I was headed, if I couldn't figure this out.
Cool, thanks!
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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