Improve code

- Redirections should be dealt with in the handling of the HTTP request.
- Session is always set when we need to render the pages.