求asp.net的 在线聊天室源码!
求asp.net的在线聊天室源代码,我的邮箱是 wulaida@126.com
哪位大哥有的,分享一下吧,万分感激!!! --------------------编程问答-------------------- up --------------------编程问答-------------------- up
jiangnengbin@126.com --------------------编程问答-------------------- 帮顶 我也想看下 --------------------编程问答-------------------- ajax实现的在线聊天室源码
http://www.51aspx.com/CV/AjaxChat --------------------编程问答-------------------- hangzhouliuyi@163.com --------------------编程问答-------------------- 我以前也问过,不过没人回答,希望你好运啦 --------------------编程问答-------------------- protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.TextBox TextBox2;
protected void Page_Load(object sender, EventArgs e)
{
Application.Lock();
string OwnerName=Session["username"].ToString();
if (!IsPostBack)
{
//私聊,发送,接收
string Owner = Application["Owner"].ToString();
string[] Ownsers = Owner.Split(',');
string receive = Application["receive"].ToString();
string[] receives = receive.Split(',');
string chat=Application["chat"].ToString();
string [] chats=chat.Split(',');
string chattime=Application["chattime"].ToString();
string[] chattimes=chattime.Split(',');
for (int i = (Ownsers.Length - 1); i>=0 ; i--)
{
if (OwnerName.Trim() == Ownsers[i].Trim())
{
//发送
TextBox2.Text = TextBox2.Text + "\n" + "您悄悄地对" + receives[i].ToString() + "说:" + chats[i].ToString() + "("+chattimes[i].ToString()+")";
}
else
{
if (OwnerName.Trim() == receives[i].Trim())
{
//接收
TextBox2.Text = TextBox2.Text + "\n" + Ownsers[i].ToString() + "悄悄地对您说:" + chats[i].ToString() + "(" + chattimes[i].ToString() + ")";
}
}
}
//公聊
int intcurrent = int.Parse(Application["current"].ToString());
string strchat = Application["chats"].ToString();
string[] strchats = strchat.Split(',');
for (int i = (strchats.Length - 1); i >= 0; i--)
{
if (intcurrent == 0)
{
TextBox1.Text =strchats[i].ToString();
}
else
{
TextBox1.Text = TextBox1.Text + "\n" + strchats[i].ToString();
}
}
}
Application.UnLock();
}
}
}
///////////////////////////////////////////////////////////////////////////
public class bottom : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DropDownList DropDownList1;
protected System.Web.UI.WebControls.CheckBox CheckBox1;
protected System.Web.UI.WebControls.TextBox TextBox2;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Button Button2;
protected ArrayList ItemList = new ArrayList();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DDLBind();
DropDownList1.Items.Insert(0,"所有人");
}
}
public void DDLBind()
{
Application.Lock ();
string users; //已在线的用户名
string[] user; //用户在线数组
if (Session["username"] != null)
{
}
else
{
Response.Redirect("../default.aspx");
}
int num = int.Parse(Application["userNum"].ToString ());
users = Application["user"].ToString();
user = users.Split(',');
for (int i=(num-1); i >= 0; i--)
{
ItemList.Add(user[i].ToString());
}
ItemList.Remove(Session["username"]);
DropDownList1.DataSource = ItemList;
DropDownList1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
Application.Lock();
string strTxt = TextBox2.Text.ToString();
int intChatNum = int.Parse(Application["chatnum"].ToString ());
if (CheckBox1.Checked)
{
//处理私聊内容
if (intChatNum == 0 || intChatNum > 40)
{
intChatNum = 0;
Application["chat"] = strTxt.ToString();
Application["Owner"] = Session["username"];
Application["chattime"] = DateTime.Now;
Application["receive"] = DropDownList1.SelectedValue.ToString();
}
else
{
Application["chat"] = Application["chat"] + "," + strTxt.ToString();
Application["Owner"] = Application["Owner"] + "," + Session["user"];
Application["chattime"] = Application["chattime"] + "," + DateTime.Now;
Application["receive"] = Application["receive"] + "," + DropDownList1.SelectedValue.ToString();
}
intChatNum += 1;
object obj = intChatNum;
Application["chatnum"] = obj;
}
else
{
//处理公共聊天内容
int intcurrent = int.Parse(Application["current"].ToString());
if (intcurrent == 0 || intcurrent >40)
{
intcurrent = 0;
Application["chats"] =Session["username"].ToString() + "对" + DropDownList1.SelectedValue.ToString() + "说:" + strTxt.ToString()+"("+ DateTime.Now.ToString()+")" ;
}
else
{
Application["chats"] = Application["chats"].ToString() + "," + Session["username"].ToString() + "对" + DropDownList1.SelectedValue.ToString() + "说:" + strTxt.ToString() + "(" + DateTime.Now.ToString() + ")";
}
intcurrent +=1;
object obj = intcurrent;
Application["current"] = obj;
}
Application.UnLock();
//刷新聊天页面
Response.Write("<script language=javascript>");
Response.Write("this.parent.right.location.reload()");
Response.Write("</script>");
}
protected void Button2_Click(object sender, EventArgs e)
{
Application.Lock();
int intUserNum = int.Parse(Application["userNum"].ToString());
if (intUserNum == 0)
Application["user"] = "";
else
{
string users; //已在线的用户名
string [] user; //用户在线数组
string OwnerName=Session["username"].ToString();
users = Application["user"].ToString();
Application["user"]="";
user = users.Split(',');
for (int i=0; i < user.Length; i++)
{
if(user[i].Trim ()!=OwnerName.Trim ())
{
Application["user"] = Application["user"] + "," + user[i].ToString();;
}
else
{intUserNum -= 1;}
}
}
object obj = intUserNum;
Application["userNum"] = obj;
Application.UnLock();
Response.Write("<script language=javascript>");
Response.Write("window.parent.location='../default.aspx';");
Response.Write("</script>");
}
private void InitializeComponent()
{
}
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
if (CheckBox1.Checked)
DDLBind();
else
{
DDLBind();
DropDownList1.Items.Insert(0, "所有人");
}
}
}
}
/////////////////////////////////////////////////////////////////////////////////////
--------------------编程问答-------------------- protected void Page_Load(object sender, EventArgs e)
{
Application.Lock();
if(Session["username"]==null)
Response.Redirect("../default.aspx");
if(Application["user"]==null)
{
string userd="";//用户列表
Application["user"] = userd;
Application["userNum"] = 0;
string chats = "";//聊天记录
Application["chats"] = chats;
//当前的聊天记录数
Application["current"] = 0;
string receive = "";//接受列表
Application["receive"] = receive;
string Owner = "";//发送列表
Application["Owner"] = Owner;
string chat = "";//私聊内容列表
Application["chat"] = chat;
Application["chatnum"] = 0; //私聊内容的当前记录数
string chattime = "";//私聊信息发送时间
Application["chattime"] = chattime;
}
int intUserNum; //在线人数
string tname; //临时用户名
string users; //已在线的用户名
string [] user; //用户在线数组
intUserNum = int.Parse(Application["userNum"].ToString());
if (intUserNum >= 40)
{
Response.Write("<script>alert('人数已满,请稍后再登录!')</script>"); Application.UnLock();
Response.Redirect("../default.aspx");
}
else
{
int flag=0;string str=Application["user"].ToString();string[] strArr=str.Split(',');
for(int i=0;i<strArr.Length;i++)
{ if(Session["username"].ToString()==strArr[i]){ flag=1;break;}}
if(flag==0)
{
if (intUserNum == 0)
Application["user"] = Session["username"].ToString();
else
Application["user"] = Application["user"] + "," + Session["username"].ToString();
intUserNum += 1;
object obj =Convert.ToInt32(intUserNum);
Application["userNum"]=obj;
Application.UnLock();}
}
}
}
}
就这么多了,用Application对象实现的,自己看吧. --------------------编程问答-------------------- zf@auto1688.com
好心大哥发我一份,等待! --------------------编程问答-------------------- mark --------------------编程问答-------------------- 真是天才啊 --------------------编程问答-------------------- thanks --------------------编程问答-------------------- 我也想要啊,我的邮箱是452758079@qq.com
想要一个能分组谈论的,最好还可以屏蔽脏话,谢谢! --------------------编程问答-------------------- 51AJax 上的可以先去看看! --------------------编程问答-------------------- 错了 是51aspx!
--------------------编程问答-------------------- 51aspx 有 源码 --------------------编程问答-------------------- 我也想要,yanpeng5_5@163.com --------------------编程问答-------------------- 我也下想要, lucialipan@gmail.com --------------------编程问答-------------------- 你去网站是 51.aspx
下载啊 --------------------编程问答-------------------- chen_zhen87@hotmail.com也给我一份啊,我急需,先谢谢啦 --------------------编程问答-------------------- 我发一个给你吧。运行环境是vs2008 --------------------编程问答-------------------- 我也想要 363162305@qq.com 不胜感激、 --------------------编程问答-------------------- 我有源码,要的找我私聊,支持传文件,图片,表情。qq 1036975606 --------------------编程问答-------------------- 有的也发给我一份:463038351@qq.com
万分感谢!!! --------------------编程问答-------------------- 我也想要....:fionsay@163.com..........thx --------------------编程问答-------------------- 在线聊天室源码 vb的 --------------------编程问答-------------------- 我正在写。。。
但是估计你已经不用了。。。 --------------------编程问答-------------------- wangtao13@126.com
我也想要·! --------------------编程问答-------------------- 能给我一份嘛,vb的。。。。。小弟不胜感激 --------------------编程问答-------------------- 能不能给我一份ASP.NET聊天室的源代码啊,急用啊,发我邮箱joanna_jiao@163.com,一定要发啊 --------------------编程问答-------------------- 295840726@qq.com跪求 --------------------编程问答-------------------- dddddddddddd --------------------编程问答-------------------- 这个基本是用AJAX进行开发,我也试过,但,
真正的聊天室,不会用网页进行开分,会用falsh进行开发
技术问题,网页不合适 --------------------编程问答-------------------- 没有帮到我
补充:.NET技术 , ASP.NET