A rigidity theorem for the solvable Baumslag-Solitar groups