hansteen was born in moss, and graduated there as a cand.jur. (candidate of law) in 1840. from 1840 to 1842 he was a deputy judge at the moss district court in moss. he was a judge in what was norway's last trail that ended in pillory, making one embarrassed in public. he later worked as a "district stipendiary magistrate" of the sør-østerdal district court from 1854 to 1869. he later worked at the solør district court from 1869 to 1879. in 1879 he became a supreme court assessor for the rest of his life.