  We consider the Casimir force acting on a $d$-dimensional rectangular piston
due to massless scalar field with periodic, Dirichlet and Neumann boundary
conditions and electromagnetic field with perfect electric conductor and
perfect magnetic conductor boundary conditions. It is verified analytically
that at any temperature, the Casimir force acting on the piston is always an
attractive force pulling the piston towards the interior region, and the
magnitude of the force gets larger as the separation $a$ gets smaller. Explicit
exact expressions for the Casimir force for small and large plate separations
and for low and high temperatures are computed. The limits of the Casimir force
acting on the piston when some pairs of transversal plates are large are also
derived. An interesting result regarding the influence of temperature is that
in contrast to the conventional result that the leading term of the Casimir
force acting on a wall of a rectangular cavity at high temperature is the
Stefan--Boltzmann (or black body radiation) term which is of order $T^{d+1}$,
it is found that the contributions of this term from the interior and exterior
regions cancel with each other in the case of piston. The high temperature
leading order term of the Casimir force acting on the piston is of order $T$,
which shows that the Casimir force has a nontrivial classical $\hbar\to 0$
limit.
