For a long, rocky river crossing that is more than 2 feet deep, the safest way to cross is to get off the bike and walk it. You will want the bike to be on the upstream side so that the water pushes the bike toward you, rather than pulls the bike away from you. Tape up the sides of your airbox to keep out water.
Some of the tougher crossings are the small creeks that drop off a couple feet, and then you have to immediately get up the other side at a very steep angle. They develop nasty ruts that can get you stuck. Your first impulse will be to take the main line, which is sometimes O.K. but often not O.K. If you can find another line, take it. If there is only one line but you know you'll get stuck if you go through it, one trick I use is to go at it sort of diagonally. Put your wheel left of the rut at the bottom of the creek bank, give it gas, and aim for the right side of the rut at the top of the creek bank (crossing the rut, in other words).
Good luck!