I\'m making a Windows Phone 7 app that has login/logout semantics (authenticating to a web app). When the user logs out I navigate back to the login screen and forget the sessio
A simpler way to just clear the backstack is to do the following
while (NavigationService.CanGoBack)
{
NavigationService.RemoveBackEntry();
}
Be aware though that if you do this in the onloaded event it will fire everytime the page is navigated to and clicking back again will close the app!
Important note, that if you use a webcontrol or the NAX ad system, the backkey is consumed by the page as well as the web control, so will exist the app rather than return to a page.
**Update Also just found an even shorter hand version from the MS dev center
while (NavigationService.RemoveBackEntry() != null);
One simple line. Nice