Exemplo n.º 1
0
        void BeginRequestOccur(object sender, EventArgs e)
        {
            HttpApplication app     = (HttpApplication)sender;
            HttpContext     context = app.Context;

            //处理DEBUG模式
            if (base.IsDebugRequest(context))
            {
                return;
            }

            //如果启用URL过滤器
            if (useFilter)
            {
                if (urlFilter != null)
                {
                    //如果不是需要处理的URL
                    if (!urlFilter.IsAllowed(context.Request.RawUrl))
                    {
                        context.Items.Add(SKIP_REQUEST, true);
                        return;
                    }
                }
            }

            //在Request的开始, 启动一个计时器
            Stopwatch watch = new Stopwatch();

            watch.Start();
            context.Items.Add("Watch", watch);
            StreamWatcher watcher = new StreamWatcher(context.Response.Filter);

            context.Response.Filter = watcher;
        }
Exemplo n.º 2
0
        public void BeginRequestOccur(object sender, EventArgs e)
        {
            HttpApplication app     = (HttpApplication)sender;
            HttpContext     context = app.Context;

            if (base.IsDebugRequest(context))
            {
                return;
            }

            //如果启用URL过滤器
            if (useFilter)
            {
                if (urlFilter != null)
                {
                    //如果不是需要处理的URL
                    if (!urlFilter.IsAllowed(context.Request.RawUrl))
                    {
                        context.Items.Add(SKIP_REQUEST, true);
                        return;
                    }
                }
            }
        }