User749918359 posted
Hello,
I made a custom convention for my razor pages so that the url of every pages looks like : https://localhost/somekey/Index instead of https://localhost/Index
Because of that, I can't make links work in the razor pages
public class CustomPageRouteModelConvention : IPageRouteModelConvention
{
public void Apply(PageRouteModel model)
{
foreach (var selector in model.Selectors.ToList())
{
var template = selector.AttributeRouteModel.Template;
// insert the buyer before the default route
selector.AttributeRouteModel.Template = "{SomeKey}/" + template;
}
}
}
The "{SomeKey}" can be a random string but it's not an existing folder.
Here, Privacy.cshtml is located in Pages/Privacy
<a class="nav-link text-dark" asp-area="" asp-page="/Privacy/">Privacy</a>
This link won't work because of the {SomeKey} parameter but I can't figure how to make it work.