Microscopic theory of the total reaction cross section and application to stable and exotic nuclei