簡単なチャットアプリケーションを作成したいです。以下のリンクを使用しました 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人のユーザーの名前だけが表示されますが、同じユーザーの名前を複数回見ることができます