Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            gv.DataSource = MainExe.GetServiceState();
            gv.DataBind();

            //string mq = MainExe.GetMsg("msmq");
            //if (string.IsNullOrEmpty(mq) == false)
            //{
            //    string[] rows = mq.Split(new char[] { '|' });
            //    List<MqCount> mcs = new List<MqCount>();
            //    foreach (string row in rows)
            //    {

            //        if (string.IsNullOrEmpty(row) == false)
            //        {
            //            string[] fileds = row.Split(new char[] { '@' });
            //            if (fileds.Length > 2)
            //            {
            //                mcs.Add(new MqCount()
            //                {
            //                    Name = fileds[0],
            //                    Count = fileds[1],
            //                    Remark = fileds[2]
            //                });
            //            }
            //        }

            //        if (mcs.Count > 0)
            //        {
            //            //gvMq.DataSource = mcs;
            //            //gvMq.DataBind();

            //        }
            //    }
            //}


            gvMqRate.DataSource = MonitorExe.GetMsg();
            gvMqRate.DataBind();
        }
Esempio n. 2
0
        public void ProcessRequest(HttpContext context)
        {
            string strOp  = context.Request.QueryString["op"];
            string strKey = context.Request.QueryString["key"];
            string strVal = context.Request.QueryString["val"];
            string strEn  = context.Request.QueryString["en"];

            if (string.IsNullOrEmpty(context.Request.Form["op"]) == false)
            {
                strOp = context.Request.Form["op"];
            }
            if (string.IsNullOrEmpty(context.Request.Form["key"]) == false)
            {
                strKey = context.Request.Form["key"];
            }
            if (string.IsNullOrEmpty(context.Request.Form["val"]) == false)
            {
                strVal = context.Request.Form["val"];
            }
            if (string.IsNullOrEmpty(context.Request.Form["en"]) == false)
            {
                strEn = context.Request.Form["en"];
            }

            if (string.IsNullOrEmpty(strEn) && CommonConfig.IsEncrypt)
            {
                Return(context, "数据必须进行加密");
                return;
            }
            else if (string.IsNullOrEmpty(strEn))
            {
                //直接继续
            }
            else
            {
                try
                {
                    //存在加密信息时,进行解密处理
                    string strRaw = EncryptAESHelper.Decrypt(strEn, CommonConfig.EncryptKey);
                    if (strRaw != (strOp + DateTime.Now.ToString("dd")))
                    {
                        Return(context, "密钥无法验证通过");
                        return;
                    }
                }
                catch (Exception ex)
                {
                    Return(context, "解密出错:" + ex.ToString());
                    return;
                }
            }


            if (string.IsNullOrEmpty(strOp))
            {
                Return(context, "Hello, here is main");
            }
            else
            {
                if (string.IsNullOrEmpty(strOp) == false)
                {
                    strOp = HttpUtility.UrlDecode(strOp);
                }
                if (string.IsNullOrEmpty(strKey) == false)
                {
                    strKey = HttpUtility.UrlDecode(strKey);
                }
                if (string.IsNullOrEmpty(strVal) == false)
                {
                    strVal = HttpUtility.UrlDecode(strVal);
                }
                switch (strOp)
                {
                case "isAlive":
                    Return(context, "1");
                    break;

                case "getBeatTime":
                    Return(context, MainExe.GetBeatTime(strKey));
                    break;

                case "beat":
                    Return(context, MainExe.Beat(strKey, strVal) ? "1" : "0");
                    break;

                case "isKeyAlived":
                    Return(context, MainExe.IsAlved(strKey) ? "1" : "0");
                    break;

                case "sendMsg":
                    MainExe.SendMsg(strKey, strVal);
                    Return(context, "1");
                    break;

                case "getMSMQConfig":
                    Return(context, MonitorExe.getMSMQConfig());
                    break;

                case "getLastConfigTime":
                    Return(context, MonitorExe.getLastConfigTime());
                    break;

                case "sendMonitorMsg":
                    MonitorExe.addMsg(strVal);
                    Return(context, "1");
                    break;
                }
            }
        }