-4

簡単なチャットアプリケーションを作成したいです。以下のリンクを使用しました http://www.codeproject.com/Articles/17617/Create-a-Chat-System-using-Ajax-and-ASP-NET

以下のコードを書いた後、chat.aspxページにリダイレクトできます

       protected void btnJoin_Click(object sender, EventArgs e)
        {
            if (getUser(txtUserName.Text, txtPassword.Text))
            {
                if(c.CheckUser(txtUserName.Text))
                {
                   // lblError.Text = "You are in the chat room already!";
 Session["UserName"] = txtUserName.Text;
                    Response.Write("<script language=\"javascript\">" + "\n");
                    Response.Write("window.open(\"Chat.aspx\",\"chat\",\"width=800\",\"height=600\",\"toolbar=no\",\"menubar=no\")" + "\n</script>");
                }
                else
                {
                    c.AddCustomer(txtUserName.Text);
                    cc.joinRoom(txtUserName.Text);
                    Session["UserName"] = txtUserName.Text;
                    Response.Write("<script language=\"javascript\">" + "\n");
                    Response.Write("window.open(\"Chat.aspx\",\"chat\",\"width=800\",\"height=600\",\"toolbar=no\",\"menubar=no\")" + "\n</script>");
                    //Response.Redirect("Chat.aspx");
                }
            }
            else
            {
                lblError.Text = "Login Failed";
            }
        }

しかし、右側のパネルでユーザーの名前を繰り返し見ることができます... 2人のユーザーがオンラインの場合、2人のユーザーの名前だけが表示されますが、同じユーザーの名前を複数回見ることができます

4

1 に答える 1

0

CustomerManagement.csに変更を加えましたが、現在は機能しています

 public void AddCustomer(string sUser)
        {
            string cAddText = "<STRONG>" + sUser + "</STRONG>";
            if (CheckUser(sUser)==false)
            {
                cArray.Add(cAddText);
            }

            if (cArray.Count > 200)
            {
                cArray.RemoveRange(0, 10);
            }
        }
于 2013-02-12T10:42:37.373 に答える