Asking for rec's

Asking for recommendations through e-mail is not a good idea, right?

if you are at the same school or workplace as the person, then ask them directly; but if you’re away from the person, e-mail is fine. it worked for me.