In this short paper, we show a sufficient condition for the solvability of the Dirichlet problem at infinity in Riemannian cones (as defined below). This condition is related to a celebrated result of Milnor that classifies parabolic surfaces. When applied to smooth Riemannian manifolds with a special type of metrics, which generalize the class of metrics with rotational symmetry, we obtain generalizations of classical criteria for the solvability of the Dirichlet problem at infinity. Our proof is short and elementary: it uses separation of variables and comparison arguments for ODEs.