当前位置: 首页>>代码示例>>C#>>正文


C# HttpApplication.IsValidRequest方法代码示例

本文整理汇总了C#中System.Web.HttpApplication.IsValidRequest方法的典型用法代码示例。如果您正苦于以下问题:C# HttpApplication.IsValidRequest方法的具体用法?C# HttpApplication.IsValidRequest怎么用?C# HttpApplication.IsValidRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.HttpApplication的用法示例。


在下文中一共展示了HttpApplication.IsValidRequest方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Respond

        public override void Respond(HttpApplication application, GlimpseConfiguration config)
        {
            if (!application.IsValidRequest(config, false, checkPath: false))
            {
                var data =
                    JsSerializer.Serialize(new { Error = true, Message = "You are not configured to access history." });
                JsonResponse(application, data);
                return;
            }

            var queue = application.Application[GlimpseConstants.JsonQueue] as Queue<GlimpseRequestMetadata>;
            if (queue != null)
            {
                var filteredQueue = from request in queue
                                    group request by request.ClientName
                                        into clients
                                        select new { Client = clients.Key, RequestCount = clients.Count() };

                var data = JsSerializer.Serialize(filteredQueue);
                JsonResponse(application, data);
                return;
            }
            else
            {
                var data = JsSerializer.Serialize(new { Error = true, Message = "No history avalible." });
                JsonResponse(application, data);
                return;
            }
        }
开发者ID:avanderhoorn,项目名称:Glimpse,代码行数:29,代码来源:Clients.cs

示例2: Respond

        public override void Respond(HttpApplication application, GlimpseConfiguration config)
        {
            if (!application.IsValidRequest(config, false, checkPath: false))
            {
                var data =
                    JsSerializer.Serialize(new { Error = true, Message = "You are not configured to access history." });
                JsonResponse(application, data);
                return;
            }

            var queue = application.Application[GlimpseConstants.JsonQueue] as Queue<GlimpseRequestMetadata>;
            if (queue != null)
            {
                var result = new Dictionary<string, object>();
                var sortedQueue = from request in queue orderby request.ClientName select request;
                var lastClient = Guid.NewGuid().ToString();

                foreach (var request in sortedQueue)
                {
                    if (!lastClient.Equals(request.ClientName))
                        result.Add(request.ClientName, new Dictionary<string, object>());

                    var dictionary = result[request.ClientName] as IDictionary<string, object>;

                    dictionary.Add(request.RequestId.ToString(), new {request.Url, request.Browser, request.RequestTime, request.IsAjax, request.Method});

                    lastClient = request.ClientName;
                }

                var data = JsSerializer.Serialize(new {Data = result});
                JsonResponse(application, data);
                return;
            }
            else
            {
                var data = JsSerializer.Serialize(new { Error = true, Message = "No history avalible." });
                JsonResponse(application, data);
                return;
            }
        }
开发者ID:mastoj,项目名称:Glimpse,代码行数:40,代码来源:Clients.cs

示例3: Respond

        public override void Respond(HttpApplication application, GlimpseConfiguration config)
        {
            if (!application.IsValidRequest(config, false, checkPath: false))
            {
                var data =
                    JsSerializer.Serialize(new {Error = true, Message = "You are not configured to access history."});
                JsonResponse(application, data);
                return;
            }

            var queue = application.Application[GlimpseConstants.JsonQueue] as Queue<GlimpseRequestMetadata>;
            if (queue != null)
            {
                var clientName = application.Request.QueryString[GlimpseConstants.ClientName];
                string data;

                if (string.IsNullOrEmpty(clientName))
                    data = JsSerializer.Serialize(queue);
                else
                {
                    var filteredQueue = from request in queue
                                        where request.ClientName.Equals(clientName)
                                        select request;
                    data = JsSerializer.Serialize(filteredQueue);
                }

                JsonResponse(application, data);
                return;
            }
            else
            {
                var data = JsSerializer.Serialize(new {Error = true, Message = "No history avalible."});
                JsonResponse(application, data);
                return;
            }
        }
开发者ID:avanderhoorn,项目名称:Glimpse,代码行数:36,代码来源:History.cs

示例4: Respond

        public override void Respond(HttpApplication application, GlimpseConfiguration config)
        {
            if (!application.IsValidRequest(config, false, checkPath: false))
            {
                var data =
                    JsSerializer.Serialize(new {Error = true, Message = "You are not configured to access history."});
                JsonResponse(application, data);
                return;
            }

            var queue = application.Application[GlimpseConstants.JsonQueue] as Queue<GlimpseRequestMetadata>;
            if (queue != null)
            {
                var result = new Dictionary<string, object>();
                IEnumerable<GlimpseRequestMetadata> data;

                var requestId = application.Request.QueryString[GlimpseConstants.ClientRequestId];
                if (!string.IsNullOrEmpty(requestId))
                {
                    data = from request in queue
                           where request.RequestId.ToString().Equals(requestId)
                           select request;

                    var requestResult = data.FirstOrDefault();
                    if (requestResult != null)
                        result.Add(requestResult.RequestId.ToString(), new { Data = requestResult.Json });
                }
                else
                {
                    var clientName = application.Request.QueryString[GlimpseConstants.ClientName];

                    if (string.IsNullOrEmpty(clientName))
                        data = queue;
                    else
                    {
                        data = from request in queue
                               where request.ClientName.Equals(clientName)
                               select request;
                    }

                    var lastClient = Guid.NewGuid().ToString();
                    foreach (var request in data.OrderBy(d => d.ClientName))
                    {
                        if (!lastClient.Equals(request.ClientName))
                            result.Add(request.ClientName, new Dictionary<string, object>());

                        var dictionary = result[request.ClientName] as IDictionary<string, object>;
                        dictionary.Add(request.RequestId.ToString(), new { Data = request.Json });

                        lastClient = request.ClientName;
                    }

                    if (!string.IsNullOrEmpty(clientName) && result.Count == 0)
                        result.Add(clientName, new Dictionary<string, object>());
                }

                var json = JsSerializer.Serialize(new { Data = result });
                JsonResponse(application, json);
                return;
            }
            else
            {
                var data = JsSerializer.Serialize(new {Error = true, Message = "No history avalible."});
                JsonResponse(application, data);
                return;
            }
        }
开发者ID:Talljoe,项目名称:Glimpse,代码行数:67,代码来源:History.cs


注:本文中的System.Web.HttpApplication.IsValidRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。