日期:2014-05-17 浏览次数:20457 次
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using WF_BLL; using WF_Model; using System.Text.RegularExpressions; public partial class Login : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void btn_Login_Click(object sender, EventArgs e) { if (!(checking(this.txt_Username.Text.Trim()) || checkings(this.txt_Username.Text.Trim()))) { Response.Write("<script> alert('只能是数字、字母、下划线、汉字!')</script>"); } else { UserInfo info = new UserInfo(); info.UserName = this.txt_Username.Text.Trim(); info.PassWord = this.txt_Password.Text.Trim(); Login_BLL login = new Login_BLL(); bool value = login.Login(info); if (!value) { Response.Write("<script> alert('注册成功!')</script>"); } else { Response.Write("<script> alert('注册失败!')</script>"); } } } public static bool checking(string strings) { return Regex.IsMatch(strings, @"^[0-9a-zA-Z_]+$"); } public static bool checkings(string strings) { return Regex.IsMatch(strings, @"^[\u4e00-\u9fa5],{0,}$"); } }