I'm a new DM playing with a group of 5 new players. (We're playing D&D 4e but more general answers are acceptable.) So far we have done 3 sessions, where we've mainly focussed on learning the mechanics and how (non-) combat encounters, skill checks, etc., work. We haven't done much roleplaying yet—they spent a bit of time in a tavern.
So most talk is OOC. I want to start encouraging a bit more roleplaying. I thought a good place to start was to get them to think of a background and/or something they would like to accomplish. 2 of them already thought about it a little bit, but the other 3 not at all.
Now, I could ask them to think of a background story before next session, but I'm curious if there are fun ways to incorporate this into the game. They are in the middle of a dungeon now, and I was thinking of putting in a trap that releases a gas which puts them in a dreamworld, where they see their possible future, or a door with a demon head in it that asks them to tell him about their past before he opens the door.
What are some effective ways you've tried to make your players think about their backgrounds (preferably while in the middle of a dungeon)?