資源簡(jiǎn)介
asp.net access 注冊(cè) 登陸實(shí)例
asp.net access 注冊(cè) 登陸實(shí)例
asp.net access 注冊(cè) 登陸實(shí)例
asp.net access 注冊(cè) 登陸實(shí)例

代碼片段和文件信息
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)//漿?撣?????
????//{
????//????//獲取要加密的字段,并轉(zhuǎn)化為Byte[]數(shù)組???
????//????byte[]?data?=?System.Text.Encoding.Unicode.GetBytes(strPassWd.ToCharArray());
????//????//建立加密服務(wù)???
????//????System.Security.Cryptography.MD5?md5?=?new?System.Security.Cryptography.MD5CryptoServiceProvider();
????//????//加密Byte[]數(shù)組???
????//????byte[]?result?=?md5.ComputeHash(data);
????//????//將加密后的數(shù)組轉(zhuǎn)化為字段???
????//????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);
????//}
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件?????311296??2009-07-17?18:12??asp.net?reg?and?login\App_Data\Databa
?????文件????????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
評(píng)論
共有 條評(píng)論