Works for me, Poul.
How are you storing the parameter? If you're putting it into a sessionValue, it should be sticky and persist through the login and beyond.
You'll need to set your filename variables EACH TIME your code runs through p_web.ProcessLink in the webhandler (because each pass through there is happening on a new thread), so set the session values the first time (when they're sent as parameters) then use those session values to set the filename variables EACH TIME.