public static string GetCustomErrorUrl(WebSite website, int statusCode) { if (website.CustomErrors.ContainsKey(statusCode)) { var page = website.CustomErrors[statusCode]; Guid PageId = default(Guid); if (System.Guid.TryParse(page, out PageId)) { return(ObjectService.GetObjectRelativeUrl(website.SiteDb(), PageId, ConstObjectType.Page)); } else { return(page); } } else { if (statusCode == 404) { return(DataConstants.Default404Page); } else if (statusCode == 500) { return(DataConstants.Default500Page); } else if (statusCode == 403) { return(DataConstants.Default403Page); } else if (statusCode == 407) { return(DataConstants.Default407Page); } else if (statusCode == 402) { return(DataConstants.Default402Page); } return(DataConstants.DefaultError); } }
public static List <ResourceCount> TopPages(SiteDb sitedb, string WeekName = null) { List <ResourceCount> pagecountes = new List <ResourceCount>(); var logs = GetLogs(sitedb, WeekName); foreach (var item in logs.GroupBy(o => o.ObjectId)) { var objectid = item.Key; var page = sitedb.Pages.Get(objectid, true); if (page != null) { ResourceCount count = new ResourceCount(); var pageurl = ObjectService.GetObjectRelativeUrl(sitedb, objectid, ConstObjectType.Page); count.Name = pageurl; count.Count = item.Count(); count.Size = item.First().Size; pagecountes.Add(count); } } return(pagecountes.OrderByDescending(o => o.Count).ToList()); }