Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Joe Dirte 21 posts 163 karma points
    May 10, 2017 @ 22:13
    Joe Dirte
    0

    Question over routing/view access

    This is probably going to be a no brainer and I apologize in advance.

    Lets create a document type foo, and give it a template fei, then a content node names fah.

    Add in whatever fields into foo, and render them in fei and populate and publish fah.

    Currently on my sandbox - which has a vanilla config - a user can go to /fah and the page will load fine.

    A user can also go to /fei and get a yellow screen of death - which is understandable, there is no model associated with the view.

    My question is, how do you prevent the user from accessing /fei in the first place. Traditional .net MVC you would just name the view _SomeView and it wouldn't be directly served up - but if I do that, Umbraco doesn't see it for me to map to it as a template.

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    May 11, 2017 @ 06:11
    Dave Woestenborghs
    100

    Hi Joe,

    Go in to your umbracoSettings.config file and locate web.routing section.

    Set the value of the attribute disableAlternativeTemplates to true

    This will disable accessing content with a template name.

    Read more about it here : https://our.umbraco.org/documentation/Reference/Config/umbracoSettings/#web-routing

    Dave

  • Joe Dirte 21 posts 163 karma points
    May 11, 2017 @ 10:53
    Joe Dirte
    0

    I guess I should really RTFM... but that brings up a point, wouldn't it be beneficial for this option to be set to true to begin with?

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    May 11, 2017 @ 11:14
    Dave Woestenborghs
    0

    hi Joe,

    I think this is a legacy thing. Older versions didn't have this setting. So alt templates would always be enabled. Setting it to true by default could potentially break sites when upgrading.

    Dave

Please Sign in or register to post replies

Write your reply to:

Draft