您目前尚未登陆,请选择【登陆】或【注册
首页->行政办公->多功能在线考试系统改进版源码>>Web/Login.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:多功能在线考试系统改进版源码
当前文件:文件类型 OnLineExamUpdate/Web/Login.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11using OnLineExam.BusinessLogicLayer; 12 13public partial class Web_Login : System.Web.UI.Page 14{ 15 protected void Page_Load(object sender, EventArgs e) 16 { 17 if (!IsPostBack) 18 { 19 if (!Object.Equals(Request.Cookies["UserID"], null)) 20 { 21 HttpCookie readcookie = Request.Cookies["UserID"]; 22 this.txtUserID.Text = readcookie.Value; 23 } 24 } 25 26 } 27 //登录按钮事件 28 protected void imgBtnLogin_Click(object sender, ImageClickEventArgs e) 29 { 30 Users user = new Users();//创建Users对象user 31 string pwdMd5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtPwd.Text.Trim(), "MD5").ToString(); 32 if (String.Compare(Request.Cookies["yzmcode"].Value, Validator.Text, true) != 0) 33 { 34 lblMessage.Text = "验证码错误!"; 35 } 36 else 37 { 38 if (user.CheckPassword(txtUserID.Text.Trim()))//根据用户编号查询用户密码 39 { 40 if (user.UserPwd == pwdMd5)//输入密码与用户密码相同 41 { 42 if (object.Equals(Request.Cookies["UserID"], null)) 43 { 44 CreateCookie(); 45 } 46 else 47 { 48 CreateCookie(); 49 } 50 Session["userID"] = txtUserID.Text.Trim();//存储用户编号 51 Response.Redirect("Default.aspx");//转向管理员操作界面 52 } 53 else//密码错误,给出提示 54 { 55 lblMessage.Text = "您输入的密码错误!"; 56 } 57 } 58 else//用户不存在,给出提示 59 { 60 lblMessage.Text = "该用户不存在!"; 61 } 62 } 63 } 64 protected void ChangeCode_Click(object sender, EventArgs e) 65 { 66 67 } 68 private void CreateCookie() 69 { 70 HttpCookie cookie = new HttpCookie("UserID"); 71 if (this.cbxRemeberUser.Checked) 72 { 73 cookie.Value = this.txtUserID.Text; 74 } 75 cookie.Expires = DateTime.MaxValue; 76 Response.AppendCookie(cookie); 77 } 78 79} 80 81
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:多功能在线考试系统改进版源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号