Exact solution of the van der Waals model in the critical region