asp.net忘记密码功能

//调用接口 post

 public string GetResponseByPost(string mobile, string messcode, string values, string utype)
{
HttpWebRequest webRequest = null;
StreamReader responseReader = null;
try
{
//ashx Url
string getGscUserUrl = "http://124.232.150.194:8120/SMS/SMSPost.ashx";
//加入参数,用于更新请求
string urlHandler = getGscUserUrl + "?mobile=" + mobile + "&messcode=" + messcode + "&values=" + values + "&utype=" + utype;
webRequest = (HttpWebRequest)HttpWebRequest.Create(urlHandler);
webRequest.Timeout = ;//3秒超时
//调用ashx,并取值
responseReader = new StreamReader(webRequest.GetResponse().GetResponseStream());
string currentUserGulid = responseReader.ReadToEnd();
return currentUserGulid.Trim();
}
catch
{
return "";
}
finally
{
responseReader.Close();
responseReader.Dispose();
}
}

//发送短信按钮(获取验证码)

 protected void SendSMS_CallBack_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
{
int i=;
TUSERBll bll = new TUSERBll();
string mobile = tb_ForgetUtel.Text.Trim(); // 手机号
string userno = tb_ForgetUname.Text.Trim(); //用户名
string strRight = mobile.Substring(mobile.Length - i, i); //手机尾号
string messcode = ""; //模板编号
string codes = bll.Get_GetGenMescode(userno, mobile);
string values = codes + "," + strRight; //模板拼接参数
string utype = "";
string result = GetResponseByPost(mobile, messcode, values, utype); //System.Collections.Hashtable hs = new System.Collections.Hashtable();
//hs.Add("code", codes); //存验证码
//hs.Add("codetime",DateTime.Now.AddMinutes(15)); //验证码有效期15分钟
DateTime codetime=new DateTime();
codetime = DateTime.Now.AddMinutes();
Session["codes"] = codes; //取验证码
Session["codetime"] = codetime; //if (Session["codes"] != null)
//{
// System.Collections.Hashtable ht = new System.Collections.Hashtable();
// ht = Session["codes"] as System.Collections.Hashtable;
// DateTime dd = Convert.ToDateTime(ht["codetime"]); //发送验证码的时间 // //判断验证码是否过期
// if (Convert.ToDateTime(ht["codetime"]) == DateTime.Now)
// { // }
//}
//json返回值
MSG t = JsonConvert.DeserializeObject<MSG>(result);
string s_result = t.result; //判断输入的手机号码与用户名是否匹配
if(codes=="")
{
SendSMS_CallBack.JSProperties["cpFlag"] = "-1";
}
else
{
SendSMS_CallBack.JSProperties["cpFlag"] = s_result; //短信发送返回值
}
}

//立即重置按钮

  protected void get_rechargeCallBack_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
{
string username = tb_ForgetUname.Text.Trim(); TUSERBll bll = new TUSERBll();
string s_coude = Convert.ToString(Session["codes"]); // 获取验证码
string ForgetUCodes = tb_ForgetUCodes.Text.Trim();
DateTime time = new DateTime();
time = Convert.ToDateTime(Session["codetime"]); //获取时间 if (s_coude!="")
{
string i = bll.Get_CheckMescode(ForgetUCodes);
if (time == DateTime.Now)
{
get_rechargeCallBack.JSProperties["cpFlag"] ="-2222";
}
else if (tb_ForgetUCodes.Text != s_coude)
{
get_rechargeCallBack.JSProperties["cpFlag"] = "-1111";
}
else if(i=="")
{
get_rechargeCallBack.JSProperties["cpFlag"] = i;
//tb_ForgetUname2.Text = username; //用户名称 Session["codes"] = null;
Session.Remove("codes");
Session["codetime"] = null;
Session.Remove("codetime"); }
else
{
get_rechargeCallBack.JSProperties["cpFlag"] = i;
} }
else if(tb_ForgetUCodes.Text != s_coude)
{
get_rechargeCallBack.JSProperties["cpFlag"] = "-1";
}
else
{
get_rechargeCallBack.JSProperties["cpFlag"] = "-1";
} }
上一篇:C++程序设计课程学习的网址


下一篇:Android生命周期详细说明