Just Copy and Paste the Code in your .aspx page.
(.aspx Page)
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button"
onclick="Button1_Click1" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
(.aspx.cs page)
public string Md5AddSecret(string sPassword)
{
System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] bs = System.Text.Encoding.UTF8.GetBytes(sPassword);
bs = x.ComputeHash(bs);
System.Text.StringBuilder s = new System.Text.StringBuilder();
foreach (byte b in bs)
{
s.Append(b.ToString("x2").ToLower());
}
return s.ToString();
}
protected void Button1_Click1(object sender, EventArgs e)
{
Label1.Text = Md5AddSecret(TextBox1.Text);
}
Click Here For Demo
(.aspx Page)
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button"
onclick="Button1_Click1" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
(.aspx.cs page)
public string Md5AddSecret(string sPassword)
{
System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] bs = System.Text.Encoding.UTF8.GetBytes(sPassword);
bs = x.ComputeHash(bs);
System.Text.StringBuilder s = new System.Text.StringBuilder();
foreach (byte b in bs)
{
s.Append(b.ToString("x2").ToLower());
}
return s.ToString();
}
protected void Button1_Click1(object sender, EventArgs e)
{
Label1.Text = Md5AddSecret(TextBox1.Text);
}
Click Here For Demo
No comments:
Post a Comment