Zachary Taylor attacked, won over and controlled the northeastern provinces of Mexico. While he had a de-facto power over them, the problem was that the Mexican government did not want to accept this officially.
In order to counter the last problem, Scott attacked Mexico City and controlled it in 1847, after which Mexico had to concede the northeastern territories.