In temptations trust not to yourself, nor to all the good resolutions and promises which you have made, but rely solely on the divine assistance; and for this reason have immediate recourse to God and the Blessed Virgin. Especially in temptations against purity, the greatest care must be taken not to remain to dispute with the temptation. In such moments some are accustomed to set their will to make acts of the contrary virtue; but they run considerable risk. The best plan to adopt on these occasions is to renew the firm purpose rather to die than to offend God, and forthwith to make the sign of the cross without remonstrance, and to call on God and the divine Mother, making frequent invocations of the most holy names of Jesus and Mary, which have a wonderful efficacy against filthy suggestions, and should therefore be invoked continually till the temptations are over. Of ourselves we have not strength to overcome the attacks of the flesh, our most cruel enemy; but God readily supplies the strength to all who ask him; but he that fails to do so, almost invariably falls a prey to the enemy.
~St. Alphonsus Liguori, The Way of Salvation and Perfection