本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例7: GetData
public override object GetData(ITabContext context)
{
var httpContext = context.GetHttpContext();
return new RequestModel(httpContext);
}
示例8: GetData
public override object GetData(ITabContext context)
{
var httpContext = context.GetHttpContext();
return string.Format("<div id='__intTestId'>{0}</div>", httpContext.Items[Expected]);
}
示例9: GetData
public override object GetData(ITabContext context)
{
var httpContext = context.GetHttpContext();
return httpContext.Request.ServerVariables.ToDictionary();
}
示例10: GetData
public override object GetData(ITabContext context)
{
var httpContext = context.GetHttpContext();
var serverModel = new ServerModel(httpContext);
return serverModel;
}