CurrentPage issues in upgrade from EPiServer 6 to 7

Vote:
 

Hi,

We have quite a large EPiServer 6 site that used PageTypeBuilder which is in the process of being upgraded to EPiServer 7. The site is compiling and we've worked through several runtime errors. We are now at the stage where the site actually runs and aspects of the CMS work, but we are having trouble displaying CMS pages.

When we try and the home page (and many other pages), we get the following error:

ContentData Cast. The requested type Site.PageTypes.Public.Home is not compatible with EPiServer.Core.PageData

Which seems strange because PageTypes.Public.Home inherits from PageData. The error occurs on this line:

BasePageHelper.CheckSecureAccess(CurrentPage, RequiresSecureConnection);

 

There is another problem with the CurrentPage object elsewhere in the site, and we get errors like this:

Object reference not set to an instance of an object.

Which occurs at this seemingly innocent line:

TwitterAndFacebookButtons.FacebookImage = CurrentPage.FacebookThumbnail.OriginalString;

 

Both of these problems appear to be caused be a difference in the CurrentPage object. I have done some searching on the web but couldn't find anything that appeared relevant.

All of our page types inherit from EPiServer.Core.PageData.

 

Can you suggest any possible causes or solutions?

Thanks.

#72378
Jun 14, 2013 13:21
Vote:
 

It sounds like you might have two different versions of EPiServer.dll loaded in your appdomain (you should see this if you attach to the process from visual studio and check in Debug/Windows/modules). 

Do you still have references to PageTypeBuilder? my thought is that maybe PageTypeBuilder is built against another version of EPiServer than your templates and if you do not have a assembly redirect then both assemblies will be loaded into the appdomain. In that case PageData from one assembly is not assignable to PageData from the other assembly.

If this is the case assembly redirects in web.config should solve your problem.

#72379
Jun 14, 2013 13:41
Vote:
 

Thanks for your reply,

There was a third party library (PageTypeExtensions) that had a dependency on PageTypeBuilder, however even with it included there was only one EPiServer.dll loaded. I have removed all references to it, cleaned and rebuilt to be sure that it wasn't causing the problem and the same issue occurs. There is still only one EPiServer.dll loaded and I have gone through all the modules and found no EPiServer related duplicates. The binaries loaded all appear to be of the correct version.

#72395
Jun 14, 2013 14:50
Vote:
 

Jallen,

 

We have done upgrade from 6 to 7 then to 7.5(also removing PTB) as well and we have really similar exception on some of page types:

ContentData Cast. The requested type WebSite.StartPage is not compatible with Castle.Proxies.SpecificPageProxy

For some reason on specific page(that is not start page) CurrentPage is requested as StartPage therefore cast error.    

 

How did you resolve this issue?

#83808
Mar 31, 2014 9:10
Vote:
 

I've done the same upgrade as Gatis. Also stuck with the same problem.
Did you manage to fix the problem Gatis?

#84753
Apr 07, 2014 12:26
Vote:
 

Good Jens Qvist that you remainded me this.

So at the moment we are using 7.6.3 versions of CMS

We had this problem one select page that is page without template and is used as container to store data and it has numerous properties defined.

What we did to get rid of

[InvalidCastException: ContentData Cast. The requested type ***.PageTypes.StartPage is not compatible with Castle.Proxies.***PageProxy]
   EPiServer.Core.ContentDataExtensions.Cast(ContentData content) +234

    

this exception is following:

Found that particular page type in CMS->Admin->Content type-> <find particular page type affected>-> Settings -> Revert to Default

 

That did the trick for me

 

I have not tested, but its possible that the same trick will work for other page types that have also templates, Jens Qvist can you confirm that?

#84759
Apr 07, 2014 12:46
Vote:
 

Okay, 

I resolved this issue this way. 

and it's soooo stupid!  :-D

Under Admin -> Config -> Manage Website
I noticed that the sitename was unknown and the local address was set to local.site.se

The problem was that the address I used in iis and hosts was local.siteupgrade.se

Sooooo, after setting a sitename, changing to the right address and adding the site in the hosts list in epi everything started working. 

My suggestion is that you check website-settings :-)

#84762
Apr 07, 2014 13:07
Vote:
 

We are currently experiencing the same issue. We uppgraded from CMS 6R2 to 7.5 and 7.6.3 through nuget packages.

Startpage loads currently but no other. We get the following on random content page navigation (from startpage).

System.InvalidCastException: ContentData Cast. The requested type Public.BasePageData is not compatible with Castle.Proxies.PublicStartPageTypeProxy.

Our startpage inherits PageData, while most other inherit BasePageData wich in turn inherit PageData.
This triggers our error handling module wich redirects to our Error page, there we get this.

System.InvalidCastException: ContentData cast. The requested type Public.ErrorPageType is not compatible with Castle.Proxies.PublicStartPageTypeProxy.

Anyone who has managed to sort this out ?

#86061
May 13, 2014 13:12
Vote:
 

First, make sure under Admin->Config->Manage Websites that they have correct DNS names and languages.

Second, try Admin->Content Type->Page Type-> find particular page type-> Settings and click Revert to Default

 

This is how we sorted it out.

#86065
May 13, 2014 13:34
Vote:
 

Manage websites corresponds with my local iis site, wich im running.

Revert to default only removed my path to the actual aspx file så it could no longer display the page, after adding it back i have the same error again.

#86066
May 13, 2014 13:39
Vote:
 

by 'correct DNS name' I mean if you access your site trough myEpiSite make sure its there with appropriate language

#86067
May 13, 2014 13:41
Vote:
 

my iis website is configured to be accessible with stfepi.local.

the url in manage website is "http://stfepi.local/" and by checking in hostnames there is also a "stfepi.local" culture was not set. We only have one language enabled on our website and i set the host name to that but it made no difference.

#86068
May 13, 2014 13:45
Vote:
 
Revert to default only removed my path to the actual aspx file så it could no longer display the page, after adding it back i have the same error again.

    You dont need aspx there.

 

When you define page you have something like this:

public partial class MyPage : EPiServer.TemplatePage<MyPageModel> ...

    

and

[ContentType(GUID = "871F6CC7-04C0-4644-8424-F421F49C8CF5", DisplayName = "My Page")]
    public class MyPageModel : EPiServer.Core.PageData
    {
...

    

this way EPiServer does not need aspx to be specified because model and page are linked

#86070
Edited, May 13, 2014 13:48
Vote:
 

My startpage was not strongly typed so i fixed it and now still loads, however when going to my default text page i still get:

System.InvalidCastException: ContentData Cast. The requested type STF_EPi.AppCode.PageTypes.Public.BasePageData is not compatible with Castle.Proxies.PublicStartPageTypeProxy

and the type and page looks like:

[ContentType(DisplayName = "[Publik] Löpande text", Order = 2, GUID = "F57E6D09-B9DC-462E-9995-FAA476AF295C")]
public class StandardPageType : BasePageData

public partial class StandardPage : TemplatePage<StandardPageType>    

then it goes to redirect to error page and still get:

System.InvalidCastException: ContentData Cast. The requested type STF_EPi.AppCode.PageTypes.Public.ErrorPageType is not compatible with Castle.Proxies.PublicStartPageTypeProxy

and the type and page for error page looks like:

[ContentType(DisplayName = "[Publik] Felsida", Order = 10, GUID = "E4B38FAC-B605-4C36-B6F9-BB310777D7BC")]
	public class ErrorPageType : BasePageData

public partial class ErrorPage : TemplatePage<ErrorPageType>

    

Also i have done the revert on all these thre page types.

#86074
Edited, May 13, 2014 14:14
Vote:
 

Sorry, these two were reasons that helped us, when you figure out your reasons please share them here

#86102
May 14, 2014 7:20
Vote:
 

So in manage websites you have added the hostname for your site? I think you might need to add "*" as hostname aswell, or maybe that just applies to multiple sites.

Have you checked your Guids? Do you have any duplicates for your pagetypes?

What does your BasePageData look like? 

#86149
May 14, 2014 18:09
Dan
Vote:
 

Mattias Jöraas Could you able to resolved your issue ? I'm facing the same problem and very keen to know how to resolve this

#86576
May 24, 2014 22:44
Vote:
 

In my case turned out my Global.asax was not inherited by EpiServer.Global, wich solved this mostly. But i still have a pagetype that stol wants to be resolved from my startpage type proxy. Currently have the epi support working on my issues.

#86584
May 26, 2014 8:28
Vote:
 

try Admin->Content Type->Page Type-> find particular page type-> Settings and click Revert to Default. This fixed my issue.

@Mattias Is epi support fixed that issue?

#89146
Aug 08, 2014 9:58
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.