资源简介

asp.net access 注册 登陆实例 asp.net access 注册 登陆实例 asp.net access 注册 登陆实例 asp.net access 注册 登陆实例

资源截图

代码片段和文件信息

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
using System.Text;
using System.Security.Cryptography;

public partial class log : System.Web.UI.Page
{
    protected void Page_Load(object sender EventArgs e)
    {

    }
    protected void btn登录_Click(object sender EventArgs e)
    {
        OleDbConnection con = new OleDbConnection(ConfigurationManager.AppSettings[“ConnectionString“]);
        OleDbCommand com = new OleDbCommand(“select * from test where UserName=‘“ + txt用户名.Text.Trim()+“‘“ con);
        con.Open();
        OleDbDataReader dr = com.ExecuteReader();
        if (dr.Read())
        {
            if (dr.GetString(2) == doEncrypt(txt密码.Text.Trim()))
            {
                Response.Write(“成功!“);
            }
            else
            {
                Response.Write(“失败!“);
            }
        }
    }

    //(a)
    private string doEncrypt(string strPassWd)//698D51A19D8A121CE581499D7B701668
    {
        return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(strPassWd “MD5“);
    }

    //(b)
    //private string doEncrypt(string strPassWd)//浆䷽撣쟲⎄꩝⌧
    //{
    //    //获取要加密的字段,并转化为Byte[]数组   
    //    byte[] data = System.Text.Encoding.Unicode.GetBytes(strPassWd.ToCharArray());
    //    //建立加密服务   
    //    System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
    //    //加密Byte[]数组   
    //    byte[] result = md5.ComputeHash(data);
    //    //将加密后的数组转化为字段   
    //    string sResult = System.Text.Encoding.Unicode.GetString(result);
    //    //显示出来   
    //    return sResult;
    //}

    //private string doEncrypt(string strPassWd)//6C-66-07-4F-9D-E5-06-6D-EF-C7-87-3C-D0-4D-B5-74
    //{
    //    strPassWd = strPassWd.ToLower();
    //    Byte[] clearBytes = new UnicodeEncoding().GetBytes(strPassWd);
    //    Byte[] hashedBytes = ((HashAlgorithm)CryptoConfig.CreateFromName(“MD5“)).ComputeHash(clearBytes);
    //    return BitConverter.ToString(hashedBytes);
    //}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     311296  2009-07-17 18:12  asp.net reg and login\App_Data\Database1.accdb

     文件        850  2009-07-17 17:39  asp.net reg and login\log.aspx

     文件       2449  2009-07-17 17:58  asp.net reg and login\log.aspx.cs

     文件        954  2009-07-17 17:37  asp.net reg and login\reg.aspx

     文件       2932  2009-07-17 17:58  asp.net reg and login\reg.aspx.cs

     文件       3559  2009-07-17 16:52  asp.net reg and login\Web.config

     目录          0  2009-07-17 18:12  asp.net reg and login\App_Data

     目录          0  2009-07-17 17:58  asp.net reg and login

----------- ---------  ---------- -----  ----

               322040                    8


评论

共有 条评论