采用md5方法对用户密码进行加密:
前台主要代码: <div>
<ul >
<li> 密 码:<asp:TextBox ID="txt_pwd" runat="server" Width="300px"></asp:TextBox></li>
<li>加密结果:<asp:TextBox ID="txt_result" runat="server" Width="300px"></asp:TextBox></li>
<li>
<asp:Button ID="btn_encrypt" runat="server" Text="md5加密"
onclick="btn_encrypt_Click" />
</li>
</ul>
</div>
后台主要代码:
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Security.Cryptography;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btn_encrypt_Click(object sender, EventArgs e)
{
txt_result.Text = md5Encrypt(txt_pwd.Text.Trim());
}
private string md5Encrypt(string sourceString)
{
UnicodeEncoding byteConverter = new UnicodeEncoding();
byte[] byteArray = byteConverter.GetBytes(sourceString);//将原字符串转换为字节数组
MD5 myMD5 = new MD5CryptoServiceProvider();
byte[] output = myMD5.ComputeHash(byteArray);
return Convert.ToBase64String(output);
}
}
本文来源:
我的异常网
Java Exception
Dotnet Exception
Oracle Exception
- 2376 - System.InvalidOperationException:修改集合;枚举操作可能无法执行
- 2377 - ORA-01747: 无效的用户.表.列
- 2378 - System.Exception: 加载报表失败
- 2379 - RDLC报表文本框显示错误号
- 2380 - Object reference not set to an instance of an object
- 2381 - System.Runtime.InteropServices.COMException (0x80004005): 无法创建目录或文件
- 2382 - 无效索引
- 2383 - 您的请求出现错误
- 2384 - ORA-28009: connection to sys should be as sysdba or sysoper
- 2385 - 项目开发中异常的处理机制
- 2386 - NHibernate.Cfg.Configuration的类型初始值设定项引发异常
- 2387 - ORA-00984列在此处不允许
- 2388 - ORA-12560:TNS:协议适配器错误
- 2389 - 错误1053:服务没有及时响应启动或控制请求
- 2390 - sql命令未正确结束
- 2391 - 目录不可写或者空间不足
- 2392 - ORA-12514: TNS: 监听进程不能解析在连接描述符中给出的 SERVICE_NAME 错误
- 2393 - 合计SQL语句出错
- 2394 - oracle7.3导入数据出错
- 2395 - 安装oracle出错