1-888-365-2779
+1-888-365-2779
Try Now
More in this section

pageBaseType

7 posts, 0 answered
  1. Will
    Will avatar
    26 posts
    Registered:
    19 Aug 2008
    28 Jul 2009
    Link to this post
    The pages element of the web.config has a pageBaseType attribute that we have set with the base page class that we need all pages to derive from.  Sitefinity appears to be ignoring this setting.  Is there a work-around, or another setting for Sitefinity to do this?

    Thanks...
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    28 Jul 2009
    Link to this post
    Hello Bill,

    We are using internally created pages and this setting does not apply to these pages. As a workaround you need to inherit InternalPage class where you can add some custom logic. Then you need to declare your custom InternalPage class under Sitefinity/cmsentrypoint.aspx

    <%@ Page Inherits="Sample.CustomInternalPage" MasterPageFile="~/Sitefinity/Dummy.master" %> 

    If you are creating stand alone pages in your projects, not that pageBaseType applies only to pages without code behind. Also you should have a custom class that inherits from System.Web.UI.Page

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Will
    Will avatar
    26 posts
    Registered:
    19 Aug 2008
    28 Jul 2009
    Link to this post
    Hey Ivan,

    If I understand you correctly, you are asking that I:

    1. Derive my PageBase class from Telerik.Cms.Web.InternalPage instead of System.Web.UI.Page.
    2. Change the inherits of cmsentrypoint.aspx.

    Here is cmsentrypoint.aspx after making the above changes as we had to add a code behind to override an abstract property:

    <%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Sitefinity/Dummy.master"
     Inherits="cmsentrypoint" CodeFile="cmsentrypoint.aspx.cs" %>
     

    This is the cmsentrypoint.aspx.cs code behind:

    using System;  
     
    public partial class cmsentrypoint : BeHeard.Components.Base.PageBase  
    {  
        protected override string PageTitlePrefix  
        {  
            get { return Resources.SiteLocalizations.PageTitlePrefix; }  
        }  
    }  
     


    After making the above changes, we receive the following error message from Telerik.Cms.Web.InternalPage: on pages that are not created under Sitefinity:

    [HttpException (0x80004005): Invalid Page request! The CMS entry point should never be called directly.]
       Telerik.Cms.Web.InternalPage.OnPreInit(EventArgs e) +533
       System.Web.UI.Page.PerformPreInit() +31
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +282

    While it appears that the pages created within Sitefinity are now working, all of the static pages are now failing due to the above error, which is being thrown by Telerik.Cms.Web.InternalPage.  Do we need to this this differently?  Our master pages require the web content form pages to derived from our PageBase class, which includes the pages created within Sitefinity that uses them.  We can't use one PageBase for our static pages, and another PageBase for Sitefinity, we must use a single PageBase.  Is there a way to prevent your class from throwing this error?

    Thanks,
    Bill
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    28 Jul 2009
    Link to this post
    Hi Bill,

    You should create a custom class that inherits from Internal page. Then add your logic to this custom class. Finally replace inherits attribute value in Sitefinity/cmsentrypoint.aspx with your custom class.

    public class CustomCmsEntryPoint : InternalPage  
    {  
        public CustomCmsEntryPoint()  
        {  
            //  
            // TODO: Add constructor logic here  
            //  
        }  
        // add logic here  
    }  
     

    <%@ Page Inherits="CustomCmsEntryPoint" MasterPageFile="~/Sitefinity/Dummy.master" %> 


    Let me know if you need further assistance or we have missed something.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Will
    Will avatar
    26 posts
    Registered:
    19 Aug 2008
    28 Jul 2009
    Link to this post
    Hey Ivan,

    That is precisely what we are trying to avoid, maintaining 2 completely seperate sets of master pages, UserControlBase, and PageBase classes.  The CustomCmsEntryPoint class presented, is a second  PageBase class.  Which requires us to manage a second set of master pages and a second set of UserControlBase classes.  As I stated in my last message, we need a solution that allows a single set of master pages and support classes to work with both static pages and Sitefinity pages.

    Thanks,
    Bill
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    29 Jul 2009
    Link to this post
    Hi Bill,

    You cannot use class that inherits from Internal page in your static aspx pages. Our CmsHttpModule that handles the requests works only for internally created pages. The CmsHttpModule sets key in the context. Afterwords the key is checked and if it does not exist an error is thrown that cmsentry point cannot be accessed. You can have one class that inherits for Internal page and use it for all cms pages. For all other pages you can use web.config's attribute. Could you elaborate what do you mean by " that allows a single set of master pages ".All master pages inherits from System.Web.UI.MasterPage since your class have to inherit from System.Web.UI.Page.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. Will
    Will avatar
    26 posts
    Registered:
    19 Aug 2008
    29 Jul 2009
    Link to this post
    Hey Ivan,

    As you know, the System.Web.UI.Page object is the center of every page request, so our PageBase class contains the core of all our base code.  Since master pages and user controls cannot exist without a page, we designed thier base objects (MasterPageBase and UserContronBase) to use the public PageBase properties and methods.  I was affraid that you were going to say this, so I created an IPageBase interface for this core functionality and a second page base class that I named CmsPageBase.  After everything was refactored to use IPageBase instead of PageBase, I only had to duplicate the code in PageBase.

    It appears to be working now, but I don't like the fact that we have an exact duplicate of the PageBase code in CmsPageBase.  I'll probably end up creating yet another class with this core functionality and use both of these classes as wrappers for the new class.

    Thanks,
    Bill
Register for webinar
7 posts, 0 answered