コード例 #1
0
        private static void ApplyPageRules(SueetieRequest _sueetieRequest)
        {
            var request    = HttpContext.Current.Request;
            var _pageRules = GetPageRuleList();

            var _pageRulesContains = _pageRules.Where(p => p.IsEqual == false).ToList();

            foreach (var _pageRule in _pageRulesContains)
            {
                if (_sueetieRequest.Url.Contains(_pageRule.UrlExcerpt, StringComparison.OrdinalIgnoreCase))
                {
                    _sueetieRequest.Url       = _pageRule.UrlFinal;
                    _sueetieRequest.PageTitle = _pageRule.PageTitle;
                }
            }

            var _pageRulesEquals = _pageRules.Where(p => p.IsEqual).ToList();

            foreach (var _pageRule in _pageRulesEquals)
            {
                if (_sueetieRequest.Url.Equals(_pageRule.UrlExcerpt, StringComparison.OrdinalIgnoreCase))
                {
                    _sueetieRequest.Url       = _pageRule.UrlFinal;
                    _sueetieRequest.PageTitle = _pageRule.PageTitle;
                }
            }
        }
コード例 #2
0
 public static void PerformRequestLogInsert(SueetieRequest sueetieRequest)
 {
     try
     {
         var provider = SueetieDataProvider.LoadProvider();
         provider.AddSueetieRequest(sueetieRequest);
     }
     catch (Exception ex)
     {
         SueetieLogs.LogException("Analytics Logging Error: " + HttpContext.Current.Request.RawUrl + " : " + ex.Message + " STACK TRACE: " + ex.StackTrace);
     }
 }
コード例 #3
0
        public static void LogRequest(string _pageTitle, int _currentContentID, int _currentUserID)
        {
            var _loggingOn = SiteSettings.Instance.RecordAnalytics;
            var request    = HttpContext.Current.Request;

            if (_loggingOn)
            {
                var _sueetieRequest = new SueetieRequest();
                _sueetieRequest.PageTitle     = DataHelper.NAit(_pageTitle);
                _sueetieRequest.Url           = SueetieUrlHelper.PrepUrlForLogging(request.RawUrl);
                _sueetieRequest.ApplicationID = SueetieApplications.Current.ApplicationID;
                _sueetieRequest.ContentID     = _currentContentID;
                _sueetieRequest.UserID        = _currentUserID;
                _sueetieRequest.RemoteIP      = request.UserHostAddress;
                _sueetieRequest.UserAgent     = request.UserAgent;
                _sueetieRequest.RecipientID   = _currentContentID > 1 ? -1 : SueetieUrlHelper.GetRecipientID(request.RawUrl);
                _sueetieRequest.ContactTypeID = _currentContentID > 1 ? 0 : SueetieUrlHelper.GetContactTypeID(request.RawUrl);
                ApplyPageRules(_sueetieRequest);
                //_sueetieRequest.PageTitle = SueetieUrlHelper.PrepTitleForLogging(DataHelper.NAit(_pageTitle), request.RawUrl);
                //_sueetieRequest.Url = SueetieUrlHelper.PrepUrlForLogging(request.RawUrl);
                try
                {
                    if (!IsCrawler &&
                        !IsNoLogUrl &&
                        !SueetieContext.Current.User.IsFiltered &&
                        !IsFilteredUrl &&
                        !SueetieUrlHelper.IsAdminPage(request.RawUrl))
                    {
                        //SueetieDataProvider provider = SueetieDataProvider.LoadProvider();
                        //provider.AddSueetieRequest(_sueetieRequest);

                        SueetieThreads.FireAndForget(new SueetieThreads.RequestLogInsertDelegate(SueetieThreads.PerformRequestLogInsert), _sueetieRequest);
                    }
                }
                catch (Exception ex)
                {
                    HttpContext.Current.Response.Write(ex.Message);
                }
            }
        }