We study the thermodynamics and phase structure of asymptotically flat nondilatonic as well as dilatonic black branes in a cavity in arbitrary dimensions (D). We consider the canonical ensemble and so the charge inside the cavity and the temperature at the wall are fixed. We analyze the stability of the black brane equilibrium states and derive the phase structures. For the zero charge case we find an analog of Hawking-Page phase transition for these black branes in arbitrary dimensions. When the charge is non-zero, we find that below a critical value of the charge, the phase diagram has a line of first-order phase transition in a certain range of temperatures which ends up at a second order phase transition point (critical point) as the charge attains the critical value. We calculate the critical exponents at that critical point. Although our discussion is mainly concerned with the non-dilatonic branes, we show how it easily carries over to the dilatonic branes as well.