setCookie method is written including this scenario.