November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
May this will help to investigate or understand the issue.
We have following controllers
public class BlogArticlePageController : PageController<ABase>
{
public ActionResult Index(BlogArticlePage currentPage)
{}
}
public class ArticlePageController : PageController<ABase>
{
public ActionResult Index(ArticlePage currentPage)
{}
}
where page types are
BlogArticlePage : ABase
ArticlePage : ABase
Probably When we are creating an Article page in CMS, Route handler is resolving wrong controller i.e. BlogArticlePageController rather ArticlePageController
This structure was absolutly working fine till 9.6.1
The action methods are not part of selecting controllers, you need to change PageController<ABase> to PageController<ArticlePage> for the page that renders ArticlePage. Since the 2 controllers are identical and renders the same type (ABase) there is no guarantee which will be picked since they are inseparable for the template engine. I agree that it was weird that it worked before and now stopped working.
We have already tested that and it works with that change. I am wondering its a very general architecture. Its a breaking change for us and not an easy fix. Is there any work arround or magical routing mapping to make it working? It will be helpful if you could briefly explain that why it was working before. It will help our client to understand the issue in a better way.
Regards
/K
You can use ITemplateResolverEvents and change the selected template based on your requirement, maybe that is a way forward.
Hi,
In result of upgrade from CMS 9.6.1 to 9.10.2. A Particular Page is giving following issue.
The routed data is of type 'XYZ.Models.Pages.ArticlePage' and the binding context data 'currentPage' is of type 'XYZ.Models.Pages.ArticlePage', neither of which matches the requested type 'XYZ.Models.Pages.BlogArticlePage'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: EPiServer.Core.TypeMismatchException: The routed data is of type 'XYZ.Models.Pages.ArticlePage' and the binding context data 'currentPage' is of type 'XYZ.Models.Pages.ArticlePage', neither of which matches the requested type 'XYZ.Models.Pages.BlogArticlePage'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[TypeMismatchException: The routed data is of type 'XYZ.Models.Pages.ArticlePage' and the binding context data 'currentPage' is of type 'XYZ.Models.Pages.ArticlePage', neither of which matches the requested type 'XYZ.Models.Pages.BlogArticlePage'.]
EPiServer.Web.Mvc.ContentDataModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +985
System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +460
where
[ContentType(DisplayName = "Blog Article", GUID = "489F9E24-A883-47C2-A11D-1314EBD0D14B"
BlogArticlePage : ABase
and
[ContentType(DisplayName = "Article Page", GUID = "5ca2415c-1a81-40cb-91e5-d182c626a308"
ArticlePage : ABase
From
The routed data is of type 'XYZ.Models.Pages.ArticlePage' and the binding context data 'currentPage' is of type 'XYZ.Models.Pages.ArticlePage', neither of which matches the requested type 'XYZ.Models.Pages.BlogArticlePage'.
BlogArticlePage has been picked wrongly
Any Idea?
Reverting changes back to 9.6.1 resolves issue.