The Anchor Tag Helper generates an <a> element’s URL through Razor Pages routing, avoiding hardcoded href values. Set asp-page and add asp-page-handler or asp-route-* attributes when needed. section 18.3
Navigation links in _Layout.cshtml
Use <a asp-area="" asp-page="/Index">Home</a> and <a asp-area="" asp-page="/Privacy">Privacy</a>. Routing generates / and /Privacy, respectively. section 18.3
Customize URL generation with these attributes:
- asp-page selects the Razor Page; asp-page-handler selects its handler. section 18.3
- asp-route-* supplies route parameters, while asp-area selects an area. section 18.3
- asp-host or asp-protocol creates an absolute URL with the requested host or HTTP protocol. section 18.3
