A few times as a kid - once on an Qantas 747 from Sydney to Perth and once in Port Hedland on an Antonov An-124 (that was obviously not in flight, we just waved at the pilot through the security fence and he let us in). Both of these were post 911.
As an adult, I was let into the cockpit on a Qantas 717 once during boarding.