I am creating a Windows 8.1 Universal App. I have three pages: Page 1,Page 2 and Page 3. I enabled the NavigationCacheMode inside the constructor on Page 2.
When i am navigating from Page 1(Login page) -> Page 2(Search screen) - > Page 3(Result Screen).
On Search screen, I am searching emails through API and then navigate to Result Page.When i press back button on result Page, my screen navigates to Page 2(Search Screen) with previous state which is okay.
But when I am logging out from Page 3(Result Page) itself then my screen would get navigates to Page 1(Login Page). and after then i again login then it would navigates to Page 2(Search Screen) but this time previous cached state of page are also there that should i don't want.
Means when i am navigating to fresh instantiated page, it captures the cached content from previous state when i was visited last time.
Suggest me. Any help would be appreciated.
Per my understanding, you would like to clear the page cache when a user logged out. If so, we can try to reset the cache by setting the Frame.CacheSize to 0 first and set back to the original value. There is a good example in Andreas Hammer's blog as below:
var cacheSize = ((Frame) Parent).CacheSize;
((Frame) Parent).CacheSize = 0;
((Frame) Parent).CacheSize = cacheSize;