protected void btnExit_Click(object sender, System.EventArgs e) { try { ChatRoom room = ChatEngine.GetRoom(Session["UserName"].ToString(), Request.QueryString["userid"]); room.LeaveRoom(Session["UserName"].ToString()); // string strScript = "<script language=javascript>self.close();</script>"; // RegisterClientScriptBlock("anything", strScript); Response.Redirect("default.aspx"); } catch (Exception ex) { } }
/// <summary> /// This function is called from the client when the user is about to leave the room /// </summary> /// <param name="otherUser"></param> /// <returns></returns> public string LeaveRoom(string otherUser) { try { ChatRoom room = ChatEngine.GetRoom(Session["UserName"].ToString(), otherUser); if (room != null) { room.LeaveRoom(Session["UserName"].ToString()); } } catch (Exception ex) { } return(""); }