Preview mode searching for views in non-existent directory

Lea Lebonski asked on March 10, 2021 13:04

Hi Guys,

so we are starting up with Kentico Xperience and for some odd reason, the content on actual page is showing fine but in the preview mode in Admin interface and in browser it throws an error searching for this directory saying the view could not be found.

~/Views/Shared/PageTypes/

My URL pattern in page type is: /

And the route:

        // Route to Home page
        routes.MapRoute(
            "Home",
            "",
            new {controller = "Home", action = "Index", id = UrlParameter.Optional}
        );

Page content pulls through properly on live site.

Any idea what I am doing wrong?

Thanks for any help you can give,

Lea

Correct Answer

Liam Goldfinch answered on March 11, 2021 00:59

Hey Lea,

It sounds like you're trying to use a custom controller to serve content while using content tree-based routing in Kentico Xperience 13?

Have you added the RegisterPageRoute assembly attribute on the controller? For example, adding the following above the controller/namespace?

[assembly: RegisterPageRoute(Home.CLASS_NAME, typeof(HomeController))]

If you're not using content tree-based routing, then ensure the right setting for Routing mode is set in the Settings application, in the URLs and SEO category under the Routing section. Then you need to ensure you are setting a URL pattern in the Home page type to /

I'd recommend reading over this page in the documentation.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Lea Lebonski answered on March 15, 2021 11:50

Hi there,

thank you so much for this. A major change to version 12. I will have to go through whole docs. Thanks for putting on the right path. :-)

Lea

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.