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


C# Visitor.CreateVisit方法代码示例

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


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

示例1: CreateVisit

        private VisitorDataSet.VisitsRow CreateVisit(HttpContext httpContext, Visitor visitor)
        {
            VisitorDataSet.VisitsRow currentVisit = visitor.CurrentVisit;
            if (currentVisit == null)
            {
                currentVisit = visitor.CreateVisit(visitor.CookieVisitId);
            }
            currentVisit.AspNetSessionId = WebUtil.GetSessionID();

            HttpRequest request = httpContext.Request;
            byte[] ip = this.GetIp(httpContext);

            string browser = request.Browser.Browser;
            string version = request.Browser.Version;
            string browserVersion = request.Browser.Version;
            string platform = request.Browser.Platform;
            string minorName = string.Empty;
            string operatingSystem = string.Empty;

            currentVisit.Ip = ip;
            currentVisit.Browser = visitor.DataContext.GetBrowser(browser, version, browserVersion);
            currentVisit.UserAgent = visitor.DataContext.GetUserAgent(request.UserAgent ?? string.Empty);
            currentVisit.GeoIp = visitor.DataContext.GetGeoIp(ip);

            var spoofedUserHostName = QueryStringHelper.SessionIPAsString;
            if( !String.IsNullOrEmpty(spoofedUserHostName) )
                currentVisit.RDNS = spoofedUserHostName;
            else
                currentVisit.RDNS = request.UserHostName ?? string.Empty;

            currentVisit.OperatingSystem = visitor.DataContext.GetOperatingSystem(platform, minorName, operatingSystem);
            currentVisit.Screen = visitor.DataContext.GetScreen(this.GetDimensions(request));

            SiteContext site = Context.Site;
            if (site != null)
            {
                currentVisit.MultiSite = site.Name;
            }

            CreateVisitArgs args = new CreateVisitArgs(currentVisit, request);
            CreateVisitPipeline.Run(args);
            return currentVisit;
        }
开发者ID:JimmieOverby,项目名称:SitecoreTrafficGenerator,代码行数:43,代码来源:TrafficGeneratorInitialize.cs

示例2: Initialize

        protected void Initialize()
        {
            // Retrieve created content items
            m_testRoot = m_home.Axes.GetChild("weblog testroot");
            m_blog1 = m_testRoot.Axes.GetChild("blog1");
            m_blog2 = m_testRoot.Axes.GetChild("blog2");

            m_entry11 = m_blog1.Axes.GetDescendant("Entry1");
            m_entry12 = m_blog1.Axes.GetDescendant("Entry2");
            m_entry13 = m_blog1.Axes.GetDescendant("Entry3");
            m_entry21 = m_blog2.Axes.GetDescendant("Entry1");
            m_entry22 = m_blog2.Axes.GetDescendant("Entry2");
            m_entry23 = m_blog2.Axes.GetDescendant("Entry3");

            var blog1Categories = m_blog1.Axes.GetChild("categories");
            m_category12 = blog1Categories.Axes.GetChild("category2");
            m_category13 = blog1Categories.Axes.GetChild("category3");

            var blog2Categories = m_blog2.Axes.GetChild("categories");
            m_category21 = blog2Categories.Axes.GetChild("category1");
            m_category22 = blog2Categories.Axes.GetChild("category2");

            m_comment1 = m_entry21.Axes.GetDescendant("comment1");

            // rebuild the WeBlog search index (or the entry manager won't work)
            var index = SearchManager.GetIndex(Settings.SearchIndexName);
            index.Rebuild();

            #if PRE_65
            //Sitecore.Analytics.AnalyticsTracker.Current.
            #else
            if (Sitecore.Configuration.Settings.Analytics.Enabled)
            {
                // Register DMS page views for popular items
                var visitor = new Visitor(Guid.NewGuid());
                visitor.CreateVisit(Guid.NewGuid());
                visitor.CurrentVisit.CreatePage().ItemId = m_entry13.ID.ToGuid();
                visitor.CurrentVisit.CreatePage().ItemId = m_entry13.ID.ToGuid();
                visitor.CurrentVisit.CreatePage().ItemId = m_entry13.ID.ToGuid();

                visitor.CurrentVisit.CreatePage().ItemId = m_entry11.ID.ToGuid();
                visitor.CurrentVisit.CreatePage().ItemId = m_entry11.ID.ToGuid();

                visitor.CurrentVisit.CreatePage().ItemId = m_entry12.ID.ToGuid();

                visitor.Submit();
            }
            #endif
        }
开发者ID:kaytee821,项目名称:WeBlog,代码行数:49,代码来源:EntryManager.cs

示例3: CreateEntryManagerForAnalyticsTest

        private EntryManager CreateEntryManagerForAnalyticsTest(params ID[] popularEntryIdsInOrder)
        {
            #if FEATURE_XDB
            var reportProvider = CreateMockReportDataProvider(popularEntryIdsInOrder);
            return new EntryManager(reportProvider, null);
            #else
            // Register DMS page views for popular items

            var visitor = new Visitor(Guid.NewGuid());
            visitor.CreateVisit(Guid.NewGuid());

            var hitCount = 1;
            for(var i = popularEntryIdsInOrder.Length - 1; i >= 0; i--)
            {
                for(var j = 0; j < hitCount; j++)
                {
                    visitor.CurrentVisit.CreatePage().ItemId = popularEntryIdsInOrder[i].ToGuid();
                }
                hitCount++;
            }

            visitor.Submit();

            return new EntryManager();
            #endif
        }
开发者ID:WeTeam,项目名称:WeBlog,代码行数:26,代码来源:EntryManagerFixture.cs


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