void CheckUserName() { string userName = We7Helper.FilterHtmlChars(HttpContext.Current.Request["userName"]); HttpContext.Current.Response.Clear(); int length = GetStrLen(userName); if (userName == "") { HttpContext.Current.Response.Write("false|用户名不能为空"); } else if (length < 5 || length > 20) { HttpContext.Current.Response.Write("false|用户名必须是5-20位"); } else if (!Regex.IsMatch(userName, @"^[\u4E00-\u9FA5a-zA-Z0-9]+$")) { HttpContext.Current.Response.Write("false|用户名必须是必须是字母、数字或组合"); } else if (AccountHelper.ExistUserName(userName)) { HttpContext.Current.Response.Write("false|该会员名已被使用"); } else { HttpContext.Current.Response.Write("true|"); } HttpContext.Current.Response.End(); }