Redirecting on other page in Windows Phone 7

In case supposed you want to  Redirect a User request on the other page in windows phone application you can use this code, give your condition when you want to redirect the user and than give the page url like below:

if (..............................)

{                                                                             

    var res = App.Current.RootVisual as PhoneApplicationFrame;

    res .Navigate(new Uri("/Page1.xaml", UriKind.Relative));                                    
                              
}

else

{

    MessageBox.Show("Wrong username or password");

}

Thank You...