Added support for redirect to correct page after login on a 401 error page.