Never march by flank in front of an army in position. This principle is absolute.
The only exception to this rule is well known for being an exception to this rule. Lee had Stonewall Jackson do this at Chancellorsville. Knowing his enemy, Joesph Hooker, Lee knew he would get away with it. And he did.