public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string username = context.Request["username"]; int count = users.GetCountByName(username); if (count == 1) { context.Response.Write("no"); } else { context.Response.Write("yes"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { url = Request["returnurl"]; } if (IsPostBack) { string txtName = Request["txtName"]; string txtRealName = Request["txtRealName"]; string txtPwd = Request["txtRealName"]; url = Request["returnurl"]; string txtCode = Request["txtCode"]; m.Users users = new m.Users(); b.Users bll = new b.Users(); int count = 0; if (bll.GetCountByName(txtName) != 0) { count++; } if (txtCode != (string)Session["validate"]) { Session["validate"] = null; count++; } if (String.IsNullOrEmpty(txtPwd)) { count++; } if (count == 0) { users.LoginId = txtName; users.Name = txtRealName; users.LoginPwd = Md5Util.GetMd5(txtPwd); users.UserStateId = 1; bll.Add(users); Session["user"] = users; if (url != null) { Response.Redirect(url); } Response.Redirect("default.aspx"); } } }