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


C# ITabContext.GetHttpContext方法代码示例

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


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

示例1: GetData

        public override object GetData(ITabContext context)
        {
            TabSection episerverTab = Plugin.Create("Section", "Content");

            PageData currentPageData = EPiServerDataFactory.GetPageData(context.GetHttpContext().Request.RawUrl);
            TabSection pageData = new TabSection("Property", "Value");
            pageData.AddRow().Column("Name").Column(currentPageData.Name);
            pageData.AddRow().Column("Page Name").Column(currentPageData.PageName);
            pageData.AddRow().Column("Page Type").Column(currentPageData.PageTypeName);
            pageData.AddRow()
                    .Column("Start Publish")
                    .Column(currentPageData.StartPublish.ToString(CultureInfo.InvariantCulture));
            pageData.AddRow()
                    .Column("Stop Publish")
                    .Column(currentPageData.StopPublish.ToString(CultureInfo.InvariantCulture));

            episerverTab.Section("Page Information", pageData);


            // Possible child page types?
            // version

            PageReference currentPageRef = EPiServerDataFactory.GetPageReference(
                context.GetHttpContext().Request.RawUrl);
            DynamicPropertyCollection dynprops = DynamicProperty.ListForPage(currentPageRef);

            TabSection dynpropData = new TabSection();

            foreach (DynamicProperty dynprop in dynprops)
            {
                PropertyData prop = dynprop.PropertyValue;

                dynpropData.AddRow().Column(prop.Name).Column(prop.IsNull ? "null" : prop.Value.ToString());
            }
            episerverTab.Section("Dynamic Properties", dynpropData);

            TabSection langData = new TabSection("Property", "Value");

            langData.AddRow().Column("Page Language").Column(currentPageData.Language);
            langData.AddRow().Column("Is Master Language").Column(currentPageData.IsMasterLanguageBranch ? "Yes" : "No");
            langData.AddRow().Column("Page Languages").Column(currentPageData.PageLanguages);
            episerverTab.Section("Languages", langData);

            return episerverTab;

        }
开发者ID:philpursglove,项目名称:Glimpse.EPiServer,代码行数:46,代码来源:EpiServerTab.cs

示例2: GetData

        public override object GetData(ITabContext context)
        {
            var res = new List<string[]> { new[] { "Subject", "Type", "Value", "Value Type", "Issuer", "Original Issuer" } };
            var httpContext = context.GetHttpContext();

            var iPrincipal = (ClaimsPrincipal)httpContext.User;
            var identity = (ClaimsIdentity)iPrincipal.Identity;

            res.AddRange(identity.Claims.Select(c => new[] {  c.Subject==null?string.Empty:c.Subject.ToString(),c.Type, 
                c.Value, c.ValueType, c.Issuer ,c.OriginalIssuer }));

            return res;
        }
开发者ID:ChrisMeeusen,项目名称:Glimpse.ClaimsInspector,代码行数:13,代码来源:ClaimsInspector.cs

示例3: GetData

        public override object GetData(ITabContext context)
        {
            var httpContext = context.GetHttpContext();

            var cart = ShoppingCart.GetCart(httpContext);
            var items = cart.GetCartDetials();

            var root = new
            {
                Details = new {
                        CartId = ShoppingCart.GetCartId(httpContext), 
                        Total = items.Any() ? items.Sum(x => x.AlbumPrice).ToString() : "--"
                    },
                Items = items
            };

            return root;
        }
开发者ID:robofdevon,项目名称:Glimpse,代码行数:18,代码来源:TabCart.cs

示例4: GetData

        public override object GetData(ITabContext context)
        {
            var requestContext = context.GetHttpContext();

            var session = requestContext.Session;
            if (session == null || session.Count == 0)
            {
                return null;
            }

            var result = new List<SessionModel>(session.Count);
            foreach (var sessionKey in session.Keys)
            {
                var key = sessionKey.ToString();
                var value = session[key];
                var type = value != null ? value.GetType() : null;
                result.Add(new SessionModel { Key = key, Type = type, Value = value });
            }

            return result;
        }
开发者ID:GProulx,项目名称:Glimpse,代码行数:21,代码来源:Session.cs

示例5: GetData

        public override object GetData(ITabContext context)
        {
            var httpContext = context.GetHttpContext();

            var result = httpContext.Application["Glimpse.AspNet.Environment"] as EnvironmentModel;
            if (result == null)
            {
                result = new EnvironmentModel
                    {
                        WebServer = BuildWebServerDetails(httpContext),
                        Framework = BuildFrameworkDetails(httpContext),
                        Machine = BuildMachineDetails(),
                        TimeZone = BuildTimeZoneDetails(),
                        Process = BuildProcessDetails()
                    };
                FindAssemblies(result);

                httpContext.Application["Glimpse.AspNet.Environment"] = result;
            }

            return result;
        }
开发者ID:TFong1,项目名称:Glimpse,代码行数:22,代码来源:Environment.cs

示例6: ProcessData

        private object ProcessData(IEnumerable<PageLifeCycleMessage> webFormsMessages, ITabContext context)
        {
            var messages = webFormsMessages as IList<PageLifeCycleMessage> ?? webFormsMessages.ToList();
            var loadingList = messages.Where(x => x.EventName.Contains("Load")).ToList();
            var renderingList = messages.Where(x => x.EventName.Contains("Render") || x.EventName.Contains("State")).ToList();

            if (loadingList.Any() && renderingList.Any())
            {
                var loadingFirst = loadingList.First();
                var loadingLast = loadingList.Last();
                var loadingTime = loadingLast.Offset - loadingFirst.Offset;

                var renderingFirst = renderingList.First();
                var renderingLast = renderingList.Last();
                var renderingTime = renderingLast.Offset - renderingFirst.Offset;

                return new { loadingTime, renderingTime };
            }

            context.Logger.Warn("No page lifecycle messages found for {0}", context.GetHttpContext().Request.RawUrl);
            return null;
        }
开发者ID:TFong1,项目名称:Glimpse,代码行数:22,代码来源:WebForms.cs

示例7: GetData

        public override object GetData(ITabContext context)
        {
            var httpContext = context.GetHttpContext();

            return new RequestModel(httpContext);
        }
开发者ID:shiftkey,项目名称:Glimpse,代码行数:6,代码来源:Request.cs

示例8: GetData

        public override object GetData(ITabContext context)
        {
            var httpContext = context.GetHttpContext();

            return string.Format("<div id='__intTestId'>{0}</div>", httpContext.Items[Expected]);
        }
开发者ID:GProulx,项目名称:Glimpse,代码行数:6,代码来源:IntegrationTestTab.cs

示例9: GetData

        public override object GetData(ITabContext context)
        {
            var httpContext = context.GetHttpContext();

            return httpContext.Request.ServerVariables.ToDictionary();
        }
开发者ID:rroman81,项目名称:Glimpse,代码行数:6,代码来源:Server.cs

示例10: GetData

 public override object GetData(ITabContext context)
 {
     var httpContext = context.GetHttpContext();
     var serverModel = new ServerModel(httpContext);
     return serverModel;
 }
开发者ID:TFong1,项目名称:Glimpse,代码行数:6,代码来源:Server.cs


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