/// <summary> /// Create a new page model. /// </summary> /// <param name="friendlyURL"></param> /// <param name="request"></param> public PageModel(string friendlyURL, HttpRequestBase request) { string id = !string.IsNullOrWhiteSpace(request["id"]) ? request["id"] : string.Empty; AdminUser AdminUser = SiteContext.User; //if a bson id was passed, and the admin user is not null, and they have the page edit role if (!string.IsNullOrWhiteSpace(id) && AdminUser != null && SiteContext.CanAdminUserAccess("page-edit")) { InEditMode = true; Page = PageDAO.LoadByBsonId(id) ?? new Page(); } else { InEditMode = Helpers.AppSettings.InDeveloperEditMode; //only continue if this is a regular page view outside of edit mode if (Page != null && !string.IsNullOrWhiteSpace(Page.Id) && !InEditMode) { ChimeraWebsite.Helpers.SiteContext.RecordPageView(friendlyURL); } Page = ChimeraWebsite.Helpers.AppCache.GetPageFromCache(friendlyURL); } }