The Church tells us that for forgiveness to take place, several elements have to be in place. First, contrition must be present. If we are not sorry, then absolution (even within the confessional) does not occur on any level, because we can not be forgiven if we are not sorry, and we can not fool God. Secondly, we must be intent on not commiting the sin again. This doesn’t mean we won’t do it again, just that we do not INTEND to do it again. If you intend on sinning again, then you do not obtain absolution. (bear in mind I use the term “absolution” in the sense of God’s forgiveness, as sacramental absolution from a priest is one and the same as absolution from God). Finally, you must complete your pennance. This is the outward showing that you acknowledge the fault of your action and are willing to make restitution. (YES I KNOW WE CANNOT SAVE OURSELVES as your Protestant friend will probably point out if you tell them that, but penance is an excercise in humility, and merely a temporal recognition that we have done something wrong). If you do not complete your pennance, then I believe you are basically sending a signal that you dont see the need to correct anything.
In specific regard to the sacrament of Confession, if you go “directly to God” in the state of perfect contrition, then you are indeed forgiven and obtain absolution outside of the confessional. But, imperfect contrition outside of the sacrament is not sufficient for absolution. Only within the confessional can your sin be absolved if your contrition is imperfect.