public void CheckLogin() { string _userticket = ""; if (Session["Ticket"] != null) { _userticket = Session["Ticket"].ToString(); } if (_userticket != "") { // 初始化保存当前在线用户的信息的datatable. DataTableForCurrentOnlineUser _onlinetable = new DataTableForCurrentOnlineUser(); // 通过ticket检查用户是否在线. if (_onlinetable.IsOnline_byTicket(this.Session["Ticket"].ToString())) { // 更新最近活动时间. _onlinetable.ActiveTime(Session["Ticket"].ToString()); // 绑定保存当前在线用户的信息的datatable到gridview控件. gvUserList.DataSource = _onlinetable.ActiveUsers; gvUserList.DataBind(); } else { // 如果当前用户不在表中,重定向页面到LogoOut. Response.Redirect("LogOut.aspx"); } } else { Response.Redirect("Login.aspx"); } }
public void CheckLogin() { string _userticket = ""; if (Session["Ticket"] != null) { _userticket = Session["Ticket"].ToString(); } if (_userticket != "") { // Initialize the datatable which used to store the information // of current online user. DataTableForCurrentOnlineUser _onlinetable = new DataTableForCurrentOnlineUser(); // Check whether the user is online by using ticket. if (_onlinetable.IsOnline_byTicket(this.Session["Ticket"].ToString())) { // Update the last active time. _onlinetable.ActiveTime(Session["Ticket"].ToString()); // Bind the datatable which used to store the information of // current online user to gridview control. gvUserList.DataSource = _onlinetable.ActiveUsers; gvUserList.DataBind(); } else { // If the current User is not exist in the table,then redirect // the page to LogoOut. Response.Redirect("LogOut.aspx"); } } else { Response.Redirect("Login.aspx"); } }