@Carel's answer to this question is perfectly acceptable, but I wanted provide another alternative.
When cornering and doing any kind of bike manoeuvring, you should be in the attack position. The attack position allows you to shift your weight around on the bike and has the added bonus of keeping your pedals flat ensuring you don't have a pedal strike.
More info from MTB Techniques:

The attack
position is achieved by standing on the pedals whilst they are
in a level position.
...
Riding in the seated position gives quite a stable riding position as
the bike can’t move very much under you. This stability comes at the
expense of manouverability, fine on smooth, wide and straight paths
but not so good when the trail gets tight and twisty. Standing up lets
you easily move about the bike for cornering and negotiating tough
obsticles.
...
- Get your pedals level.
- Use your arms to keep the bike upright.
- Stay relaxed, use your arms and legs as extra suspension. Keep your knes apart to help with balance and cornering.
- Lower your upper body towards the bars with your elbows out for better steering control.
YouTube demo of the attack position:
This video is aimed at mountain biking but still provides a good overview of the things going on here.