You can do a multi-step process by dynamically loading other user controls within your webpart to help keep the webpart complexity down and logic where it should be. For a good example, take a look at the MyAccount webpart (\CMSWebparts\Membership\Profile\MyAccount.aspx) In there, you can see they are loading user controls and providing links to other user controls with url params which only the webpart sees.
To also have the wrapper which sets your variables, you create that as it's own webpart which calls your specific logic to set those variables in the specific events you want. Then you place this webpart on the master page. When a user visits the site those variables are set based on whatever logic you have in place and are then accessible in your other user controls and webparts. Taken this approach many times vs. having ASPX pages complicate the process and upgrade path.
I'm not stating it's 100% the right way to go but I've proven it works in many applications and its simple to maintain and upgrade.