正文

.net_Ajax聊天室项目系列解读(login.aspx.cs)2008-10-31 09:52:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/yzrj/39170.html

分享到:

using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;public partial class Login : System.Web.UI.Page{    protected void btnLogin_Click(object sender, EventArgs e)    {        System.Threading.Thread.Sleep(3000);//停留3秒        string userName = this.txtUserName.Text.Trim();//账号        string password = this.txtPassword.Text.Trim();//密码        string retypePwd = this.txtRetypePwd.Text.Trim();//重新输入的密码        //用户在聊天室中,但此次输入的密码不正确,提示       if (Room.Instance.UserIsChatting(userName)&&Room.Instance.GetUser(userName).Password != password)        {            this.lblMessage.Text = "请输入正确密码";        }        else//成功登录        {            if (!Room.Instance.UserIsChatting(userName))//输入的账号没有正在聊天            {                Room.Instance.AddUser(userName, password);//添加用户                //发送一条系统消息                Room.Instance.SendMessage(String.Format("{0} 进入了聊天室", userName));            }            Room.Instance.GetUser(userName).Update();            FormsAuthentication.RedirectFromLoginPage(userName, false);        }    }}

阅读(2690) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册