We did this derivation in class. We took a cross section of an ideal solenoid and took a rectangular loop to apply ampere's circuital law. It is pretty much the same as in the diagram but the sides 'ad' and 'bc' were extended such that the loop covered the complete solenoid including the current coming 'out of page'. The current going in from the top cancels the current moving out from the bottom so the summation of B.dl from the four sides of loop will be equal to zero. The sides bc and ad are perpendicular to B so B.dl for them is zero.
Now we were told that as the sum of B.dl for sides cd and ba is zero, B outside is zero (keep in mind this is not the diagram we were working on, the side cd has engulfed the solenoid, so both segments, ab and cd, are on the outside of solenoid).
But it could also be the case that B.dl for cd is negative of B.dl for ab because after all element dl is in opposite direction for both while B must be in the same direction (I mean B outside the solenoid). So how can you justify that B outside= 0?
Hope you got my question.