Hello friend,
when you are retrieving data (password) back from database then decrypt that and compare. And i did this using UTF8 and decoded back :
like this :
public string DecryptString(string pwd)
{
try
{
UTF8Encoding encoder = new System.Text.UTF8Encoding();
Decoder utf8Decode = encoder.GetDecoder();
byte[] toDecode_byte = Convert.FromBase64String(pwd);
int charCount = utf8Decode.GetCharCount(toDecode_byte, 0, toDecode_byte.Length);
char[] decoded_char = new char[charCount];
utf8Decode.GetChars(toDecode_byte, 0, toDecode_byte.Length, decoded_char, 0);
string decodedPwd = new string(decoded_char);
return decodedPwd;
}
catch
{
return null;
}
}
Hope this will help you.
Don't forget to mark as answer if it helps. :)