The topic, you cited is over two years old and shows way to solve the problem that is already solved in newest versions of Yii -- currently CWebUser is setting returnUrl and nothing of what is shown in that old topic should be done manually.

I started the topic to look for any ideas, why my CWebUser is not setting this variable properly.

This method instead of assigning the value to returnUrl, it is storing the value in session.

My fear :

When application configures the components by reading the main configuration file, Does the uninitialised state of other components or a component in question affect the creation of that particular component?.In our case when the component user is crearted, is the component session available to configure the user?.

There is such property like CWebUser.returnUrl, but -- as I discovered -- it is only set properly in situations, where login process is called automatically by Yii. That is: if user is not logged-in (authenticated) and requests any operation that requires authentication. In any other situation, returnUrl contains "index.php", and this is considered as Yii feature, not a bug (at least now).

This is kind of big problem. You not only have to record your current URL, but you also have to take care of not recording login form URL or actions like CCaptchaActions route. In other word, this is (as for me) to big task, for time resources I have to spend on this. So, unless this will become fixed in next release of Yii, I'm leaving it like it is now -- i.e. after manual login, user will be redirected to home page.

I am experiencing a similar issue. I am new to Yii and have read some of the posts and have managed to get some aspects working, such as after successful login, going to the correct page and not the index page as before.

However, when I enter this web address 'http://trackstar:8888/index.php?r=project' in the browser I am not redirected to the Login screen as I should because I haven't logged in yet.

I am working from Jeffrey Winesett's latest book (2012) on Yii and he states that after running the CRUD Generator, and without any configuration of the application it should work: ie
#1 Successfully log in and you should go to the 'project' section of the app.
#2 enter the above address and you should be redirected to the Login screen.

Anyone wanting to know what I have done to fix the first part see below. As far as the second issue is concerned I am at a loss.