Search code examples
c#windows-phone-7isolatedstorage

how to persist data in IsolatedStorageSettings in windows phone even when application is closed?


I want to store some basic information to prevent login each time for that I am using IsolatedStorageSettings but data is stored only till application is open how can I persist data even when application is closed and get back when application is started again. My code is as below to store information I uses

public static IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
settings.Add("user", MainPage.user);

to retrive it I use

if (MainPage.settings.Contains("user"))
{
      MainPage.user = (User)MainPage.settings["user"];                            
}

here MainPage.user is a static object of class User in class MainPage.


Solution

  • You need to call the Save method:

    settings.Save();