Пример #1
0
        /// <summary>
        ///     检测验证码是否正确
        /// </summary>
        /// <param name="sessionKey">保存到session的key</param>
        /// <param name="code">用户输入的验证码</param>
        public static bool Check(string sessionKey, string code)
        {
            if (string.IsNullOrWhiteSpace(code))
            {
                return(false);
            }

            var verifyCode = Cookies.Get(sessionKey);

            Cookies.Set(sessionKey, Rand.GetRandom(10000, 99999));

            return(code.Trim().IsEquals(verifyCode));
        }
Пример #2
0
 /// <summary>
 ///     转到网址(默认为最后一次访问)
 /// </summary>
 public static void GoToUrl(string url = "")
 {
     if (string.IsNullOrWhiteSpace(url))
     {
         url = Cookies.Get(SystemConfigs.ConfigInfo.Cookies_CallBack_Url);
     }
     if (string.IsNullOrWhiteSpace(url))
     {
         url = "http://" + GetDomain(0);
     }
     if (url.StartsWith("?"))
     {
         url = MvcReq.GetPageName() + url;
     }
     HttpContext.Current.Response.Redirect(url);
 }