温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:达达ASP.NET企业信息管理系统
当前文件路径:DaDaEnterprise/Admin/Default.aspx.cs

1using System; 2
using System.Collections; 3
using System.Configuration; 4
using System.Data; 5
using System.Data.SqlClient; 6
using System.Web; 7
using System.Web.Security; 8
using System.Web.UI; 9
using System.Web.UI.HtmlControls; 10
using System.Web.UI.WebControls; 11
using System.Web.UI.WebControls.WebParts; 12
13
public partial class Admin_Default : System.Web.UI.Page 14
{ 15
protected void Page_Load(object sender, EventArgs e) 16
{ 17
18
} 19
20
protected void Sub_Click(object sender, EventArgs e) 21
{ 22
string PassWord = FormsAuthentication.HashPasswordForStoringInConfigFile(Pwd.Text.ToString(), "MD5"); 23
string sql = "select * from [Admin] where AdminName= '" + Name.Text + "'and AdminPwd='" 24
+ PassWord + "'"; 25
DataTable Dt = DataAccess.GetDataTable(sql); 26
if (Dt.Rows.Count > 0) 27
{ 28
if (Session["Code"].ToString() == ChkCode.Text) 29
{ 30
Session["Admin"] = Name.Text; 31
Session["Pwd"] = Pwd.Text; 32
Response.Redirect("./Admin.aspx"); 33
} 34
else Response.Write("<script>alert('验证码错误!');history.go(-1);</script>"); 35
} 36
else Response.Write("<script>alert('用户名或密码错误!');history.go(-1);</script>"); 37
} 38
39
}





}
}