温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:狂龙通讯录信息系统V1.0
当前文件:
KuangLongCommunication/Login.aspx.cs[3K,2009-6-12 11:46:36],打开代码结构图
KuangLongCommunication/Login.aspx.cs[3K,2009-6-12 11:46:36],打开代码结构图1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
using System.Data.SqlClient; 12
13
public partial class Login : System.Web.UI.Page 14
{ 15
amendPassword transfer; 16
17
protected void Page_Load(object sender, EventArgs e) 18
{ 19
20
} 21
protected void btnLogin_Click(object sender, EventArgs e) 22
{ 23
24
transfer = new amendPassword(); 25
string NewPwd = this.txtUserPwd.Text.Trim(); 26
//string Oldpwd = transfer.EncryptPassword(NewPwd, "MD5").Trim(); 27
string sqlQuery = "select userId,userPwd from Users where userId='" + txtUserName.Text.Trim() + "'"; 28
29
//string pwdQuery = "select userPwd from Users where userId='" + txtUserName.Text + "'"; 30
//SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["VoteConnectionString"]); 31
//SqlCommand cmd = new SqlCommand(sqlQuery, conn); 32
33
DataBase DB = new DataBase(); 34
DataTable dt = DB.DataSelect(sqlQuery); 35
try 36
{ 37
//conn.Open(); 38
//SqlDataReader sdr = cmd.ExecuteReader(); 39
int Row = dt.Rows.Count; 40
if (Row==0) 41
{ 42
//string pwd1 = sdr["userPwd"].ToString(); 43
//string tt = transfer.EncryptPassword(pwd1, "MD5"); 44
//if (tt == Oldpwd) 45
// if (sdr["userPwd"].ToString() == Oldpwd) 46
//{ 47
// conn.Close(); 48
// Session["userID"] = txtUserName.Text.Trim(); 49
// Response.Redirect("TreeAddress/Tree.aspx"); 50
51
52
////} 53
//else 54
//{ 55
// //Response.Write("<script language=javascript>alert('密码错误!')</script>"); 56
57
58
59
//} 60
Response.Write(amendPassword.Show_MessageBox("没有此用户!")); 61
this.txtUserName.Text = ""; 62
this.txtUserName.Focus(); 63
return; 64
65
66
67
} 68
else 69
{ 70
//Response.Write("<script language=javascript>alert('用户名错误或不存在')</script>"); 71
string sel_userid = dt.Rows[0]["UserID"].ToString(); 72
string sel_Pwd = dt.Rows[0]["userPwd"].ToString().Trim(); 73
string confirm_pwd = transfer.EncryptPassword(NewPwd, "MD5").Trim(); 74
if (sel_Pwd != confirm_pwd) 75
{ 76
Response.Write(amendPassword.Show_MessageBox("用户密码错误!")); 77
this.txtUserPwd.Text.Trim(); 78
this.txtUserPwd.Focus(); 79
return; 80
81
82
} 83
else 84
{ 85
86
Session["userID"] = txtUserName.Text.Trim(); 87
Response.Redirect("TreeAddress/Tree.aspx"); 88
89
90
} 91
92
93
94
} 95
96
} 97
catch (System.Exception ee) 98
{ 99
Response.Write("script language=javascript>alert('" + ee.Message.ToString() + "')</script>"); 100
101
102
103
104
} 105
106
} 107
} 108





amendPassword transfer;

}
}