protected void btnPhoneValid_Click(object sender, EventArgs e) { //发送短信验证码 ZTSmsAdapter zt = new ZTSmsAdapter("yuecheng", "1qaz3edc%TGB", "676766"); Random r = new Random(); RandomReslt = r.Next(100000, 999999).ToString(); var result = zt.Send(new List<string> { txtUserMobile.Text }, "尊敬的用户,您的短信验证码是" + RandomReslt + ",该消息将在24小时后过期"); Helper.ExecScript("alert('验证码已发送,请注意查收');"); }
public static void ValidMobile(string mobileNumber) { ZTSmsAdapter zt = new ZTSmsAdapter("yuecheng", "1qaz3edc%TGB", "676766"); string validCode = new Random().Next(100000, 999999).ToString(); ZTSmsAdapter.Result result = zt.Send(mobileNumber, string.Format("尊敬的用户,您的手机验证码是{0}, 请立即完成注册,验证码将在60秒后过期", validCode)); string json = "{"; if (result != null) json += string.Format("\"success\":{0},\"code\":\"{1}\"", result.Id, validCode); json += "}"; HttpContext.Current.Response.Write(json); }