예제 #1
0
        private static PageData FindPageByName(PageReference rootPage, string pageName, string pageType)
        {
            PageDataCollection children = DataFactory.Instance.GetChildren(rootPage);

            children.Add(DataFactory.Instance.GetChildren(rootPage, LanguageSelector.MasterLanguage()));

            return(children.FirstOrDefault(page => page.PageName.Equals(pageName) && page.PageTypeName.Equals(pageType)));
        }
예제 #2
0
        /// <summary>
        /// Redirects to UserProfile
        /// </summary>
        private static void RedirectToUserProfilePage(PageBase page)
        {
            EPiServerProfile user = EPiServerProfile.Current;

            if (user.IsAnonymous || !(string.IsNullOrEmpty(user.FirstName) || string.IsNullOrEmpty(user.LastName)))
            {
                return;
            }

            PageReference      start    = GetWorkroomStartPageLink(page);
            PageReference      parent   = DataFactory.Instance.GetPage(start).ParentLink;
            PageDataCollection children = DataFactory.Instance.GetChildren(parent);
            PageData           data     = children.FirstOrDefault(child => child.PageTypeName.Equals(UserProfilePageTypeName));

            if (data == null)
            {
                return;
            }
            string symbol  = data.LinkURL.Contains("?") ? "&" : "?";
            string url     = HttpUtility.UrlEncode(page.Request.RawUrl);
            string callUrl = string.Format("{0}{1}{2}={3}", data.LinkURL, symbol, returnUrlUserProfile, url);

            page.Response.Redirect(callUrl);
        }