I have 2 static methods for decoding and encoding a string using MachineKey.Protect and MachineKey.Unprotect:
/// <summary>
/// Method to Encrypt a string
/// </summary>
/// <param name="value">string value to encrypt</param>
/// <returns></returns>
private static string GetEncryptedString(string value)
{
var stringBytes = Encoding.UTF8.GetBytes(value);
var encString = Convert.ToBase64String(MachineKey.Protect(stringBytes));
return encString;
}//end of GetEncryptedString()
/// <summary>
/// Method to decrypt a string that has be encryptied
/// </summary>
/// <param name="encString">Encrypted string to decrypt</param>
/// <returns></returns>
private static string GetDecryptedString(string encString)
...
Go to the complete details ...