protected void Page_Load(object sender, EventArgs e) { if (this.User == null || !this.User.Identity.IsAuthenticated) { Response.Redirect("~/Error/AuthError.aspx?source=Chatroom"); } else if (this.User.IsInRole("Administrator")) { currentUser = Administrator.Get(); } else { currentUser = DatabaseUtilities.GetUser(this.User.Identity.Name); } cr = ChatroomManager.GetChatroom(currentUser.GroupNumber); // register this page with the Chatroom cr.RegisterReceiver(this); // put all the messages in the chatroom on the page PopulateChatMessages(); }