program to encode and decode a given text in vs2010

Posted by Vijayar under ASP.NET on 4/6/2011 | Points: 10 | Views : 1236 | Status : [Member] | Replies : 1
program to encode and decode a given text in vs2010

vijaya


Responses

Posted by: Susanthampy on: 5/24/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi,


Use this,

private string EncodeString(int s)

{
byte[] b = System.Text.Encoding.Default.GetBytes(s.ToString());
return Convert.ToBase64String(b, 0, b.Length);
}
private string DecodeString(string s)
{
byte[] b = Convert.FromBase64String(s);
return System.Text.Encoding.Default.GetString(b);
}


Regards,
Susan

Vijayar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response