protected void btnLogin_Click(object sender, EventArgs e) { string _error; // Check the value of user's input data. if (check_text(out _error)) { // Initialize the datatable which used to store the // information of current online user. DataTableForCurrentOnlineUser onLineTable = new DataTableForCurrentOnlineUser(); // An instance of user's entity. UserEntity _user = new UserEntity(); _user.Ticket = DateTime.Now.ToString("yyyyMMddHHmmss"); _user.UserName = tbUserName.Text.Trim(); _user.TrueName = tbTrueName.Text.Trim(); _user.ClientIP = this.Request.UserHostAddress; _user.RoleID = "MingXuGroup"; // Use session variable to store the ticket. this.Session["Ticket"] = _user.Ticket; // Log in. onLineTable.Login(_user, true); Response.Redirect("CurrentOnlineUserList.aspx"); } else { this.lbMessage.Visible = true; this.lbMessage.Text = _error; } }
protected void btnLogin_Click(object sender, EventArgs e) { string _error; // 检查用户输入数据值. if (check_text(out _error)) { // 初始化保存当前在线用户的信息的datatable. DataTableForCurrentOnlineUser onLineTable = new DataTableForCurrentOnlineUser(); // 用户身份实例. UserEntity _user = new UserEntity(); _user.Ticket = DateTime.Now.ToString("yyyyMMddHHmmss"); _user.UserName = tbUserName.Text.Trim(); _user.TrueName = tbTrueName.Text.Trim(); _user.ClientIP = this.Request.UserHostAddress; _user.RoleID = "MingXuGroup"; // 使用session变量保存ticket. this.Session["Ticket"] = _user.Ticket; // 登入. onLineTable.Login(_user, true); Response.Redirect("CurrentOnlineUserList.aspx"); } else { this.lbMessage.Visible = true; this.lbMessage.Text = _error; } }