tabassum pervez
tabassum pervez

Reputation: 77

cookie managment in windows phone 7 application

I want to develop the functionality of remember the user's credentials for the next time login of the user in windows phone 7 application (like "remember me " functionality on the websites) Please tell me how to do this in windows phone 7.

Thanks

Upvotes: 0

Views: 229

Answers (2)

Daniyal
Daniyal

Reputation: 1

There are a few updates on the above answer.

To save:

private void SaveCredentials()
{ 
      IsolatedStorageSettings.ApplicationSettings.Add("username", username);
      IsolatedStorageSettings.ApplicationSettings.Add("password", password.ToString());
}

To retrieve:

string username = IsolatedStorageSettings.ApplicationSettings["username"];
string password = IsolatedStorageSettings.ApplicationSettings["password"];

Upvotes: 0

Amulya Khare
Amulya Khare

Reputation: 7708

You can store the credentials in the Phone's Isolated storage. Your application's isolated storage cannot be accessed by any other application. The simplest way would be something like:

public void SaveCredentials()
{
    var settings = IsolatedStorageSettings.ApplicationSettings;
    settings.Add("username", "user123");
    settings.Add("password", Encrypt("password123");
}

You can then retrieve it as :

string username = settings["username"].ToString();
string password = Decrypt(settings["password"].ToString());

You can write a Encryption / Decryption method depending on you security requirements. There are a number of ways that have different level of security and complexity. To help you get started one such way could be found HERE.

Upvotes: 1

Related Questions