MD5加密网站(c#)

2017-11-03  本文已影响0人  xuanxi

一、文件---->新建----->网站----->空网站

右击website2---->添加新项------>web窗体--------->default.aspx

二、设计页面(TextBox1;Button1;Label1)

将button1--->属性---->Text:改为MD5加密

三、写代码

在头部加上命名空间using System.Web.Security;

【default.aspx.cs】

附源码:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.Security;

public partial class _Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

}

protected void Button1_Click(object sender, EventArgs e)

{

string strtxt = TextBox1.Text;

Label1.Text = FormsAuthentication.HashPasswordForStoringInConfigFile(TextBox1.Text, "MD5");

}

}

上一篇 下一篇

猜你喜欢

热点阅读