Try our conversational search powered by Generative AI!

PageTypeBuilderException in EPiServer CMS 6

Vote:
 

Hi all,

I'm working with EPIServer cms 6.0 and PageTypeBuilder 2.0 since a few day ago.
When I start my application an error is generated:

The current page is not of type DefaultPageType. This often occurs when no id query string parameter is specified.

Exception Details: PageTypeBuilder.PageTypeBuilderException: The current page is not of type DefaultPageType. This often occurs when no id query string parameter is specified

Stack Trace:

[PageTypeBuilderException: The current page is not of type DefaultPageType. This often occurs when no id query string parameter is specified.]
   PageTypeBuilder.UI.LoadTypedCurrentPage`1.get_CurrentPage() +441
   EPiServer.PageBase.get_CurrentPage() +42
   lib.Cms.EPiSrvr.Util.SecurityHandler.CheckAccess(PageBase page, AccessLevel accessLevel) +97
   lib.Cms.EPiSrvr.Util.SecurityHandler.get_EditAccess() +39
   lib.Cms.EPiSrvr.TemplatePage.OnPreInit(EventArgs e) +131
   System.Web.UI.Page.PerformPreInit() +31
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +328

where I try to start the application with a aspx page that is called
Default.aspx

Can somebody help me?  

#61394
Sep 18, 2012 22:11
Vote:
 

Have you read this blog post including the comments? Also, you say CMS 6.0 and PTB 2, are you sure about 6.0? PTB 2 requires 6 R2 so that may be the cause.

#61395
Sep 18, 2012 23:11
Vote:
 

Sorry, the CMS version is 6.1.379.0 and PTB is 2.0.0.0. 

Should be any problems between both that cause the error?
  

#61423
Sep 19, 2012 14:32
Vote:
 

That combination should work fine. Unless you're experience the problem(s) described in the blog post + comments I don't know why this is happening. If so, could you provide more context? Such as: part of the source for the page type class, part of the source for the template, request URL and any information about any modifications that have been made to the URL rewriting on the site.

#61436
Sep 19, 2012 17:54
Vote:
 

Thanks again. I attach some lines that can help better to understand this issue.

I added the code lines in Global.asax as it told in the blog but it didn't work.

here goes, DefaultPageType.cs

namespace Point.Cms.EPiSrvr.PageTypeBuilder.Pages {
 [PageType(AvailableInEditMode = false)]
 public abstract class DefaultPageType : BasePageType, IHasTargetDisplay {
  [PageTypeProperty(EditCaption = "Heading",
   HelpText = "",
   SortOrder = 10,
   UniqueValuePerLanguage = true,
   Required = false,
   Searchable = true,
   Tab = typeof(InformationTab),
   Type = typeof(PropertyString))]
  public virtual string Heading { get; set; }

  [PageTypeProperty(EditCaption = "Sub heading",
   HelpText = "",
   SortOrder = 20,
   UniqueValuePerLanguage = true,
   Required = false,
   Searchable = true,
   Tab = typeof(InformationTab),
   Type = typeof(PropertyString))]
  public virtual string SubHeading { get; set; }

  [PageTypeProperty(EditCaption = "Browser title",
   HelpText = "",
   SortOrder = 30,
   UniqueValuePerLanguage = true,
   Required = false,
   Searchable = false,
   Tab = typeof(InformationTab),
   Type = typeof(PropertyString))]
  public virtual string BrowserTitle { get; set; }

  [PageTypeProperty(EditCaption = "Url to image",
   HelpText = "",
   SortOrder = 40,
   UniqueValuePerLanguage = true,
   Required = false,
   Searchable = false,
   Tab = typeof(InformationTab),
   Type = typeof(PropertyDocumentUrl))]
  public virtual string Image { get; set; }

  public virtual string ImageAlignment { get; set; }

  [PageTypeProperty(EditCaption = "Image text",
   HelpText = "",
   SortOrder = 50,
   UniqueValuePerLanguage = true,
   Required = false,
   Searchable = false,
   Tab = typeof(InformationTab),
   Type = typeof(PropertyString))]
  public virtual string ImageText { get; set; }

  [PageTypeProperty(EditCaption = "Preamble",
   HelpText = "",
   SortOrder = 60,
   UniqueValuePerLanguage = true,
   Required = false,
   Searchable = true,
   Tab = typeof(InformationTab),
   Type = typeof(PropertyLongString))]
  public virtual string Preamble { get; set; }

  [PageTypeProperty(EditCaption = "Main body",
   HelpText = "",
   SortOrder = 70,
   UniqueValuePerLanguage = true,
   Required = false,
   Searchable = true,
   Tab = typeof(InformationTab),
   Type = typeof(PropertyXhtmlString))]
  public virtual string MainBody { get; set; }

  [PageTypeProperty(EditCaption = "Meta keywords",
   HelpText = "",
   SortOrder = 80,
   UniqueValuePerLanguage = true,
   Required = false,
   Searchable = false,
   Tab = typeof(MetaDataTab),
   Type = typeof(PropertyString))]
  public virtual string MetaKeywords { get; set; }

  [PageTypeProperty(EditCaption = "Meta description",
   HelpText = "",
   SortOrder = 90,
   UniqueValuePerLanguage = true,
   Required = false,
   Searchable = false,
   Tab = typeof(MetaDataTab),
   Type = typeof(PropertyString))]
  public virtual string MetaDescription { get; set; }

  [PageTypeProperty(EditCaption = "Meta author",
   HelpText = "",
   SortOrder = 100,
   UniqueValuePerLanguage = true,
   Required = false,
   Searchable = false,
   Tab = typeof(MetaDataTab),
   Type = typeof(PropertyString))]
  public virtual string MetaAuthor { get; set; }

  [PageTypeProperty(EditCaption = "Portlet manager",
   HelpText = "",
   SortOrder = 110,
   UniqueValuePerLanguage = false,
   Required = false,
   Searchable = false,
   Tab = typeof(PortletManagementTab),
   Type = typeof(PropertyPortletManager))]
  public virtual string PortletManager { get; set; }

  [PageTypeProperty(EditCaption = "FeedSource1",
   HelpText = "",
   SortOrder = 300,
   UniqueValuePerLanguage = true,
   Required = false,
   Searchable = false,
   Tab = typeof(FeedsTab),
   Type = typeof(PropertyPageReference))]
  public virtual string FeedSource1 { get; set; }

  [PageTypeProperty(EditCaption = "FeedSource2",
   HelpText = "",
   SortOrder = 310,
   UniqueValuePerLanguage = true,
   Required = false,
   Searchable = false,
   Tab = typeof(FeedsTab),
   Type = typeof(PropertyPageReference))]
  public virtual string FeedSource2 { get; set; }

  [PageTypeProperty(EditCaption = "FeedSource3",
   HelpText = "",
   SortOrder = 320,
   UniqueValuePerLanguage = true,
   Required = false,
   Searchable = false,
   Tab = typeof(FeedsTab),
   Type = typeof(PropertyPageReference))]
  public virtual string FeedSource3 { get; set; }

  [PageTypeProperty(EditCaption = "Javascript in head",
   HelpText = "Javascript in head",
   SortOrder = 330,
   UniqueValuePerLanguage = true,
   Required = false,
   Searchable = false,
   Tab = typeof(JavaScriptTab),
   Type = typeof(PropertyLongString))]
  public virtual string JavaScriptInHead { get; set; }

  [PageTypeProperty(EditCaption = "Target display",
   HelpText = "Select the platform where this page is visible",
   SortOrder = 350,
   UniqueValuePerLanguage = true,
   DefaultValue = PropertyTargetDisplay.Desktop,
   DefaultValueType = DefaultValueType.Value,
   Required = true,
   Searchable = true,
   Tab = typeof(InformationTab),
   Type = typeof(PropertyTargetDisplay))]
  public virtual string TargetDisplay { get; set; }
 }
}

 

#61448
Sep 19, 2012 19:55
Vote:
 

If you let the ASPX-template inherit TemplatePage instead of TemplatePage<T> and add a breakpoint somewhere in the page life cycle, what type is the object returned by CurrentPage?

#61449
Sep 19, 2012 20:11
Vote:
 

Ok, finally then I did the changes I can open the site but my question now is if these changes could affect in the functionality of the site.

(TemplatePage instead of TemplatePage<T>)    

#61450
Sep 19, 2012 21:31
Vote:
 

I only meant that you should do them temporarily. You have a problem that the CurrentPage property returns an object that isn't of the expected type and to figure out the cause it would be good to know what type of object it does return. Typically this would only happen if the page type is mapped to a template file whose type parameter is a different type or if for some reason the id query string parameter is stripped causing the start page to be loaded instead of the expected page, as in the blog post.

#61451
Sep 19, 2012 21:34
Vote:
 

Thanks Joel, I'm going to working to solve this issue based on your comments.

#61480
Sep 20, 2012 14:38
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.