The query is very close to correct

Just need to capture the session state variable to the front aspx