温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:三层新闻发布管理系统源码
当前文件:
TreeLayerNews/news2005/ascx/Login.ascx.cs,打开代码结构图
TreeLayerNews/news2005/ascx/Login.ascx.cs,打开代码结构图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
12
public partial class ascx_Login : System.Web.UI.UserControl 13
{ 14
Model.admin Ma = new Model.admin(); 15
BLL.admin Ba = new BLL.admin(); 16
17
protected void Page_Load(object sender, EventArgs e) 18
{ 19
if (!Page.IsPostBack) 20
{ 21
this.login_E.Visible = false; 22
} 23
} 24
protected void Cancel_Click(object sender, EventArgs e) 25
{ 26
this.UserName.Text = ""; 27
this.PassWord.Text = ""; 28
this.UserName.Focus(); 29
} 30
protected void login_Click(object sender, EventArgs e) 31
{ 32
Ma.username = this.UserName.Text.Trim(); 33
Ma.password = FormsAuthentication.HashPasswordForStoringInConfigFile(this.PassWord.Text.Trim(),"MD5"); 34
if (Ba.ReRowCount(Ma)>0) 35
{ 36
Session["admin"] = Ma.username.ToString(); 37
Response.Redirect("../Web/admin/Admin_Index.aspx"); 38
} 39
if (Ba.UserLogin(Ma).Tables[0].Rows.Count>0) 40
{ 41
Session["username"] = Ma.username.ToString(); 42
} 43
this.login_s.Visible = false; 44
this.login_E.Visible = true; 45
this.Label.Text = Session["username"].ToString(); 46
} 47
protected void Login_out_Click(object sender, EventArgs e) 48
{ 49
this.login_s.Visible = true; 50
this.login_E.Visible = false; 51
Session.Clear(); 52
} 53
} 54




Model.admin Ma 
}
}