title: Yii Error 400 The CSRF token could not be verified when trying to delete the post
body: <p>When I was trying to delete a post I got this error:</p>
  
  <pre><code>Yii Error 400 The CSRF token could not be verified
  </code></pre>
  
  <p>I don't know what is exactly causing this and to what it could be related. here is my action delete:</p>
  
  <pre><code>    public function actionDelete($id) {
  
           if (Yii::app()-&gt;request-&gt;isPostRequest) {
                  // we only allow deletion via POST request
                  $this-&gt;loadModel($id)-&gt;delete();
  
                  // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
                  if (!isset($_GET['ajax']))
                  $this-&gt;redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
          }
          else
                throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
      }
  
      protected function afterDelete()
      {
          parent::afterDelete();
          Image::model()-&gt;deleteAll('name='.$this-&gt;id);
          Date::model()-&gt;deleteAll('tbl_show_id='.$this-&gt;id);
          Press::model()-&gt;deleteAll('tbl_show_id='.$this-&gt;id);
      }
  </code></pre>