public bool getCode() { var smsHelper = new SMSHelper(); string mobile, code = ""; try { UserBll uBll = new UserBll(); mobile = Request.Params["mobile"].ToString(); if (uBll.CheckCanSendSms(mobile)) { code = DateTime.Now.ToString("ssff"); //code = "1234"; Session["generate_code"] = code; smsHelper.SendSms(mobile, code); SMSLog smsLog = new SMSLog() { telephone = mobile, content = code, Browser = Request.Browser.Browser, ip = Request.UserHostAddress, kdate = DateTime.Now }; uBll.AddUserSMSLog(smsLog); } return(true); } catch (Exception) { return(false); } }