コード例 #1
0
        void OnBeginRequest(object sender, EventArgs e)
        {
            if (PreProcessRequest())
            {
                CustomProfile profile = HttpContext.Current.Profile.AsCustomProfile();

                long startTick = DateTime.Now.Ticks;
                try
                {
                    //Logger.BeginAccess();

                    profile.Init(HttpContext.Current);

                    string host = HttpContext.Current.Request.Url.Host;
                    if (host.IndexOf(".gammatrix.com") < 0)
                    {
                        SiteManager.SiteAndHost siteAndHost = SiteManager.GetByHostName(host);
                        cmSite site = SiteManager.GetSiteByDistinctName(siteAndHost.Site.DistinctName);

                        /*SiteCDNAccessRule rule = SiteCDNAccessRule.Get(site, false);
                         *
                         *
                         * string ip = HttpContext.Current.Request.GetRealUserAddress();
                         *
                         * if (rule.IPAddresses.Where(f=>f.Value == ip).Count() == 0)
                         * //if (!ip.Equals("119.39.124.139", StringComparison.InvariantCulture) &&
                         * //!ip.Equals("124.233.3.10", StringComparison.InvariantCulture))
                         * {
                         *  GEOLocationCDN.CheckGeoLocation(HttpContext.Current, profile.IpCountryID.ToString());
                         * }*/
                    }

                    MvcHttpHandlerEx hander = new MvcHttpHandlerEx();
                    hander.PublicProcessRequest(HttpContext.Current);
                }
                catch (Exception ex)
                {
                    ExceptionHandler.Process(ex);
                    //Logger.Exception(ex);
                }
                finally
                {
                    Logger.EndAccess((DateTime.Now.Ticks - startTick) / 10000000.000M);
                    HttpContext.Current.Response.End();
                }
            }
        }