Example #1
0
 /// <summary>
 /// 请求的返回函数
 /// </summary>
 /// <param name="retCode">返回代码:-9:异常,-5:没有权限,-3:未登陆,-1:没有数据,0:执行成功</param>
 /// <param name="retMsg">返回信息:字符串(如果是Json字符串自动解析)</param>
 public void Ret(int retCode, string retMsg)
 {
     if (g_IsAjax)
     {
         // Response.Write(Json.WriteRaw(retCode, retMsg));
         if (retCode == -3)
         {
             string login = "******";
             Response.Write(login);
             Response.End();
             return;
         }
     }
     else if (Request.RawUrl.ToLower() == "/prowebequactive/default.aspx" && retCode == -3)
     {
         Response.Redirect("/prowebequactive/login.aspx?type=-3&msg=" + retMsg, true);
         LogMessageHelper.LogINFO("尝试访问未登录系统。");
     }
     else
     {
         Response.Redirect("/prowebequactive/errpage.aspx?type=" + retCode + "&msg=" + retMsg, true);
     }
     Response.Flush();
     Response.Clear();
 }
Example #2
0
        /// <summary>
        /// 检查License并返回相关值
        /// </summary>
        /// <param name="licenseFilePath">License文件的路径</param>
        /// <returns>字符串数组:[返回值标识,应用程序标识, 使用截止日期]
        ///   返回值标识: -1:日期过期
        ///               -2:授权码错误
        ///               -9:系统错误
        ///               0:正确返回
        /// </returns>
        public static string[] CheckLicense(string licenseFilePath)
        {
            try
            {
                string   text  = FileHelper.GetFileText(licenseFilePath);
                string[] texts = text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);

                // 判断授权是否过期
                DateTime dtSrc = Tools.GetDateTime(texts[1], DateTime.Now.AddYears(-100));
                DateTime dtNow = DateTime.Now;
                // 授权过期
                if (dtSrc.AddDays(1) < dtNow)
                {
                    return new string[] { "-1", "-1", "" }
                }
                ;                                          //

                // 判断密钥串是否正确 + texts[2] + "\r\n"
                string keyMust = Tools.GetMD5Str(texts[0] + "\r\n" + texts[1] + "\r\n" + Consts.KEY_SECRETSTR);
                // 授权码错误
                if (keyMust != texts[2])
                {
                    return new string[] { "-2", "-2", "" }
                }
                ;                                                 //

                return(new string[] { "0", texts[0], texts[1] }); // , texts[2]
            }
            catch (Exception ex)
            {
                Dictionary <string, string> logParms = new Dictionary <string, string>();
                logParms["licenseFilePath"] = licenseFilePath;
                //系统错误[日志]
                LogMessageHelper.LogINFO("检查License出错", logParms, null, ex);
                return(new string[] { "-9", "-3", "" });//"-3",
            }
        }