Try our conversational search powered by Generative AI!

Getting "InvalidCastException" After Migrate to 7.5

Dan
Dan
Vote:
 

Recently we have upgrade our EpiServer CMS to 7.5 (from 7) and now we are getting following error when try to load some pages

"ContentData Cast. The requested type xxxxx is not compatible with Castle.Proxies.StartPageProxy" (in here I have replaced real page type with xxxxx)

Doing some debugging, we have found out that, this exception is coming when try to access PageLink of CurrentPage (i.e CurrentPage.PageLink)


Note: in our project, using PageTypeBuilder, all inbuilt EpiServer Page types are converted in to relevant Page Types and Templates

#86436
May 21, 2014 15:04
Vote:
 

Have you added your hostname and startpage in Adminmode? 

Under Admin -> Config -> Manage Website
You need to set sitename and hostname.

Had the same error and it was resolved by doing this. 

#86462
May 22, 2014 9:58
Vote:
 

Also check so no references exists to pagetypebuilder. In fact remove all the pagetypebuilder dll's you have in your project.

#86463
Edited, May 22, 2014 10:00
Dan
Vote:
 

Thank Jens for your Reply.

Actually sitename and hostmane are ok and there aren't any reference to pagetypebuilder dlls too. Still wondering why this is happening. All these came into action after we did the 7.5 upgrade

#86466
Edited, May 22, 2014 10:19
Vote:
 

Do you get this on all pagetypes. I mean is StartPageType the only one working?


Try going to your pagetype in EPiServer Admin and do a "Revert to default". 

Here´s a forumpost about the same error

#86468
May 22, 2014 11:22
Dan
Vote:
 

Yes Jens, I have already gone through the forum post you have shared. "Revert to default" doesn't worked for me either. And also, this error is only appearing in one pagetype. Other pagetypes working fine.

#86484
May 22, 2014 14:36
Vote:
 

Can you post the top part of your template for the pagetype (Codebehind)? Does the template for the pagetype have same inheritances as other working templates?

#86486
May 22, 2014 14:40
Vote:
 

Oh and have you checked in db if there are any duplicates?

#86487
May 22, 2014 14:40
Dan
Vote:
 

How do I check duplicates in DB (are you refering to check tblPageType ?)

#86489
May 22, 2014 14:45
Vote:
 

SELECT *

FROM tblContentType WHERE Name = 'YourPageType'

You could also take a look if the Guid on the pageType in EPiServer admin for your specific pagetype have any duplicates. Maybe it shares guid with StartPageType

Just a wild guess though. :-D

SELECT *
FROM tblContentType WHERE ContentTypeGUID = 'Guid for affected pagetype' 

#86491
May 22, 2014 14:52
Dan
Vote:
 

Thanks Jens for your prompt help. But there isn't any duplicate GUIDs or sharing GUID between 2 types in the DB  

#86516
May 22, 2014 20:56
Dan
Vote:
 

This is the pagetype

[ContentType(GUID = "75A99539-4462-4FCE-A533-3116714157C9",
	DisplayName = "MyPageType",
	Description = "My Page Type",
	Order = 800,
	AvailableInEditMode = true )]
[AvailableContentTypes(Include = new Type[] { typeof(MyPageType1), typeof(MyPageType2), typeof(MyPageType3) })]
[SiteImageUrl]
public class MyPageType : PageBase
{
	
}

public class PageBase : PageBaseAbstract
{
	
}

public abstract class PageBaseAbstract : PageData
{
	
}

And this is the pagetemplate

public partial class MyPageTemplate : PageTemplateBase<MyPageType>
{

}

public abstract class PageTemplateBase<T> : TemplatePage<T> where T : PageData
{

}
#86521
May 22, 2014 23:07
Dan
Vote:
 

Any help ?

#86565
May 23, 2014 15:54
Dan
Vote:
 

Couple of week back we manage to resolve this issue. Root-cause for this problem was, we are using "classic" links (links that has "id" parameter in querystring ) in some part of our solution. By default Episerver 7.5 doesn't support query parameter "ID" (it's a 7.5 breaking change). So, as a solution, we have implement classic routing (using EPiServer.Web.Routing.ClassicLinkRoute) in our application and it's worked.   

#87471
Jun 13, 2014 12:39
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.