code: public function setSessionAndRedirect($key, $value, $redirectUrl)
      {
          $this->getSession()->set($key, $value);
          return $this->redirect($redirectUrl);
      }
docs: Sets a session variable and redirects to the URL
  @author Taiwo Ladipo <ladipotaiwo01@gmail.com>
  @param $key
  @param $value
  @param $redirectUrl
  @return \yii\web\Response