Horses are not negative or difficult by nature - there is always a reason. I always tell my clients and riders to give the horse the benefit of the doubts and focus on improving their way of communicating their message to their horse.
So why does not the do what you are asking for while riding?
The reason might be that you are not being the horseleader when you are riding, but if we think about the horse only, this is most likely the reason why your horse is not doing what you want him to do:
He is not able to - his body might not be strong enough to do what you're asking for or it might be pain related
He does not understand what you are asking for - you need to improve or change the way you ask
A combination of the above
Never look at you horse as difficult!
Always give the horse the benefit of the doubts
Find the "why"