user registration form issue

I have two controllers sitecontroller and usercontroller inside protected/controllers folder.the register

action is defined inside the usercontroller.php file and this actionregister method renders the register.php view file(containing registration form) found inside protected/views/user/ folder. but when i put index.php?r=user/register in the url, it automatically redirects to index.php?r=site/login which is the login form.given below is the code of actionregister method.

public function actionRegister()

    {


          $model=new User('register');





         // uncomment the following code to enable ajax-based validation


         


         if(isset($_POST['ajax']) && $_POST['ajax']==='user-register-form')


           {


             echo CActiveForm::validate($model);


             Yii::app()->end();


           }


         





         if(isset($_POST['User']))


          {


             $model->attributes=$_POST['User'];


               if($model->validate())


               {


                  // form inputs are valid, do something here


                  //return;


                  $model->save();


                  //$this->redirect($this->render('finished',array('form'=>$form))); 


                  $this->redirect(Yii::app()->user->returnUrl);


               }


          }


          $this->render('register',array('model'=>$model));


    }   

what may be the reason for this?

Refer to filters(), if your controller has ‘filters()’ and ‘accessControl’ is set on the filter then you will need to allow non-authenticated users to open register page by updating ‘accessRules()’.




  public function accessRules() {

    return array(

      array(

        'allow',  // allow all users to access 'index' and 'view' and 'register' actions.

        'actions'=>array('index','view', 'register'), // <= add register action here

        'users'=>array('*'),

      ),

      //

    )

  }