Igrot Moshe Even Ha-Ezer Vol.1 56, by Rabbi Moshe Feinstein (translation from here):
Since the prohibition is meant to prevent erotic thought, one is
entitled to rely upon his own ability to divert his mind from such
thought when he has to go somewhere for such things as his livelihood.
He is not obligated to make a financial sacrifice or to neglect his
other needs. Only when he has no need to pass, as when there is
another route, or when he is only going on an outing, even if there is
no other route, is he forbidden to rely upon his ability to divert his
mind. This is the prohibition of "Guard yourself from every evil
thing." One should not without cause rely upon one's own ability to
evoid erotic thought...
this probably applies in surfing the internet also for certain sites