This is such an important topic, thanks for asking. My wife asked me this, fairly early on. My immediate response was to go where most WS's go..."I feel so awful, this is so unlike me, I could never allow myself to ever do this again...". But the truth is, I felt exactly the same way BEFORE I cheated. And that's what my wife pointed out to me.
That's why our "why's" are so important. Because if I felt that way and yet, did it anyway, then I could no longer rely on my own sense of self-disgust to dissuade me in the future, at least, not until I knew and understood how exactly I failed to embrace my own sense of morality and dignity. Until that happened, I realized that I was just as dangerous to my marriage and myself as I was before. In order to KNOW that I would not do it ever again, I had to first figure out WHY I did it and then take steps to change whatever was needed in my life to ensure that it never happens again.
Once I cleared out the skeletons and other muck from my closet, I changed. The way I think changed, and the way I react changed, and things I place value on changed. And when that happened, it was much clearer to my wife that I had changed as well, and that allowed her to let her walls down... at least a little. The rest of the equation is simply "time and consistency." Not only did I change, but that change lasted, and she saw it tested now and then as well, and saw the difference. That helped both of us to move forward.
I dunno. I often compare infidelity to alcoholism. Even a person who hasn't had a drink in 20 years still says, "I'm an alcoholic," because they realize that they are always just one drink away from sober. In that same way, even though I know I'll never allow myself to cheat again, I still bear in mind that I had the potential once, and I hated the experience, so if I catch even a whiff of opportunity, I'm three steps towards the door *(Song reference intentional).
I think I'd rather cut my own nads off before cheating again, and I mean that.