本文整理汇总了C#中System.Web.Routing.RequestContext.CurrentPage方法的典型用法代码示例。如果您正苦于以下问题:C# RequestContext.CurrentPage方法的具体用法?C# RequestContext.CurrentPage怎么用?C# RequestContext.CurrentPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Routing.RequestContext
的用法示例。
在下文中一共展示了RequestContext.CurrentPage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessOutputCache
private void ProcessOutputCache(RequestContext requestContext)
{
if (HttpContext.Current == null)
return;
var user = requestContext.HttpContext.User;
if (user == null || user.Identity.IsAuthenticated)
return;
ICacheManager cacheManager = RouteExtensions.ResolveService<ICacheManager>(requestContext.RouteData);
if (adhereToConfig && !cacheManager.Enabled)
return;
var page = new OutputCachedPage(cacheManager.GetOutputCacheParameters());
page.ProcessRequest(HttpContext.Current);
cacheManager.AddCacheInvalidation(requestContext.CurrentPage(), HttpContext.Current.Response);
}
示例2: GetVirtualPath
public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values)
{
ContentItem item;
Debug.WriteLine("GetVirtualPath for values: " + values.ToQueryString());
values = new RouteValueDictionary(values);
// try retrieving the item from the route values
if (!TryConvertContentToController(requestContext, values, ContentItemKey, out item))
{
// no item was passed, fallback to current content item
item = requestContext.CurrentItem();
if (item == null)
// no item = no play
return null;
if (!RequestedControllerMatchesItemController(values, item))
// someone's asking for a specific controller so we let another route handle it
return null;
}
if (item.IsPage)
return ResolveContentActionUrl(requestContext, values, item);
// try to find an appropriate page to use as path (part data goes into the query strings)
ContentItem page = values.CurrentItem<ContentItem>(ContentPageKey, engine.Persister);
if (page != null)
// a page parameter was passed
return ResolvePartActionUrl(requestContext, values, page, item);
page = requestContext.CurrentPage<ContentItem>();
if (page != null && page.IsPage)
// next use the current page
return ResolvePartActionUrl(requestContext, values, page, item);
page = item.ClosestPage();
if (page != null && page.IsPage)
// fallback to finding the closest page
return ResolvePartActionUrl(requestContext, values, page, item);
// can't find a page, don't link
return null;
}