public string SMS(string tel) { SMS sms = new SMS(); sms.SendCode(tel); return sms.ErrorMessage; }
protected void btnGetCode_Click(object sender, EventArgs e) { string to = Session["FP_userName"].ToString(); SMS sms = new SMS(); sms.SendCode(to); Tick = 120; if (sms.ErrorMessage == "成功") lbSMS.Text = "短信验证已发送(10分钟内有效)。"; else lbSMS.Text = sms.ErrorMessage; }
public string GetSmsCode(string mobile, string code) { try { if (code.Trim().ToUpper() != HttpContext.Current.Session["verificationCode"].ToString()) return "0"; SMS sms = new SMS(); sms.SendCode(mobile); return sms.ErrorMessage; } catch (Exception ex) { return ex.ToString(); } }
public string Get(string id) { try { if (id.Trim().ToUpper() != HttpContext.Current.Session["verificationCode"].ToString()) { return "0"; } SMS sms = new SMS(); sms.SendCode(Security.UserMobile); return sms.ErrorMessage; } catch (Exception) { } return "发送失败"; }
protected void btnGetCode_Click(object sender, EventArgs e) { string code = verificationCode.Text.Trim().ToUpper(); if (code == HttpContext.Current.Session["verificationCode"].ToString()) { SMS sms = new SMS(); sms.SendCode(phone); Tick = 120; if (sms.ErrorMessage == "成功") lbSMS.Text = "短信验证已发送(2分钟内有效)。"; else lbSMS.Text = sms.ErrorMessage; } else lbSMS.Text = "图片验证码不正确"; }
protected void btnGetCode1_Click(object sender, EventArgs e) { string to = phone; //判断字符串是否为数字 Int64 num = 0; if (!Int64.TryParse(to, out num)) { lbSMS1.Text = "提示:请输入正确的手机号。"; return; } string code = verificationCode1.Text.Trim().ToUpper(); if (code == HttpContext.Current.Session["verificationCode"].ToString()) { SMS sms = new SMS(); sms.SendCode(to); Tick = 120; Session["TickValidityTime"] = DateTime.Now.AddMinutes(2); if (sms.ErrorMessage == "成功") lbSMS1.Text = "短信验证已发送(10分钟内有效)。"; else lbSMS1.Text = sms.ErrorMessage; } else lbSMS1.Text = "图片验证码不正确"; }