setFlash redirect error

Hi all,

I have the following code, adopted from Yii CRUD:


public function actionDelete()




			// we only allow deletion via POST request




            Yii::app()->user->setFlash('succes', 'Gebruiker is verwijderd!');



			throw new CHttpException(500,'Invalid request. Please do not repeat this request again.');



Deleting works, but I don't get my flash message. I think the redirect is causing this.

Anyone knows a solution to this, or is this a bug?


First you set a flash message and then you redirect. Redirect sends a http header for redirects and stops script execution.

Well, I tried that either, but that doesn't work too.

I think its because the AJAX request that is made by clicking on the delete button of a CRUD table.


Ajax request can mess with this stuff.

Is the function you showed called by an ajax request. If so, the redirect won't work anyway.