コード例 #1
0
 public ActionResult Main()
 {
     ViewBag.Types = UrlTypeBLL.TypesScript;
     if (GetStr.GetCurrentMinute % 3 != 0)
     {
         Task.Factory.StartNew(() => WebSiteSecurity.Request());
     }
     return(View());
 }
コード例 #2
0
        public HttpResponseMessage PerformTask([FromBody] JObject obj)
        {
            dynamic parameter = obj;

            if (parameter != null)
            {
                string method = parameter.method.ToString().ToLower();
                switch (method)
                {
                case "web":
                    Task.Factory.StartNew(() => WebSiteSecurity.Request(true));
                    break;

                case "icom":
                    string        res         = string.Empty;
                    U_Url_ListBLL bll_UrlList = new U_Url_ListBLL();
                    Task.Factory.StartNew(() => _urlcheckresult("SystemAuto"));
                    break;
                }
            }
            return(JsonConvert.SerializeObject("执行成功").ToHttpResponseMessage());
        }
コード例 #3
0
        private ActionResult UrlCheckResult()
        {
            string res = string.Empty;

            try
            {
                Task.Factory.StartNew(() => WebSiteSecurity.Request());
                int i = 0, j = 0, h = 0;
                var list = bll_UrlList.Find().FindAll(n => n.Status == EnumUrlStatus.Normal.GetHashCode());
                foreach (var item in list)
                {
                    i++;
                    if (!item.Url.UrlVerification())
                    {
                        j++;
                        bll_UrlList.UpdateStatus(item.Id, EnumUrlStatus.NotDefined.GetHashCode(), this.CurrenUserInfo.UserAccount);
                    }
                    if (item.IconImg.IsNotNull() &&
                        !System.IO.File.Exists(string.Format("{0}\\{1}", Images.GenerateIconsPath, item.IconImg)) &&
                        !item.IcomStream.IsNotNull() &&
                        !item.IconImg.UrlVerification())
                    {
                        h++;
                        item.IconImg       = "";
                        item.LastUpdate_Id = this.CurrenUserInfo.UserAccount;
                        bll_UrlList.Update(item);
                    }
                }
                res = string.Format("本次检测{0}条数据,其中网址{1}条访问异常,图片网址{2}条访问异常", i, j, h);
            }
            catch (Exception ex)
            {
                res = string.Format("本次检测发生异常:Exception:{0}     StackTrace:{1}", ex.ToString(), ex.StackTrace);
            }
            return(this.Json(res, JsonRequestBehavior.AllowGet));
        }
コード例 #4
0
 public ActionResult WebSiteSecurityCheck()
 {
     Task.Factory.StartNew(() => WebSiteSecurity.Request(true));
     Thread.Sleep(1000 * 6);
     return(this.Json("执行成功", JsonRequestBehavior.AllowGet));
 }