Closed Cinnam00n closed 2 years ago
Everything in OC is module (area) including host web project.
If you project name is OrchardCore.Cms.Web
then tag helper to refer to Privacy page for OrchardCore.Cms.Web/Pages/Privacy.cshtml
should be referred in tag helper as
<a class="nav-link text-dark" asp-area="OrchardCore.Cms.Web" asp-page="/Privacy">Privacy</a>
@ns8482e While what you are saying is right; I think normally it should resolve a frontend route when we are not passing any area on a View that is rendered on the frontend. The same goes for a backend View.
@ns8482e now that you say it, it feels obvious but I spent a good deal of time trying to find a solution using documentation, without success. It might be a good idea to specify it explicitly in the tutorial on setting up the decoupled CMS site.
I guess if you don’t define area then default behavior of the tag helper takes current serving controller’s area or first match
here the issue is because of having tag helper is in layout and serving controller vary, so it’s better to define area
Is it not related with the DI priority?
@Skrypt it's ASP.NET CORE's default behavior - if area is omitted - It would take area of executing controller if area and controller is omitted it will take area and controller of current executing action
Ok then it is by design and we should close the issue.
Issue
After following documentation instructions on setting up decoupled CMS the behaviour of
asp-page
tag helper breaks.For example, in the
_Layout.cshtml
file we have a navlink<a class="nav-link text-dark" asp-area="" asp-page="/Privacy">Privacy</a>
which instead of redirecting to the Privacy page, redirects to
https://localhost:7181/Admin/OrchardCore.Settings/Admin/Index?page=%2FPrivacy
Expected Behaviour
Page navigation works the same way as in Razor Pages project template.