In my _Layout.cshtml page, I have a list item in the main navigation bar. I want to show a css class depending on the current route. For example, if the user is at www.website.com/Notifications, I want to add the class to the Notifications list item. This is my attempt. It does not work:
<li><a asp-page="/Notifications" class="@(<%=Url.RequestContext["id"]%> == "Notifications" ? Html.Raw("selected-club") : Html.Raw(""))"><i class="fas fa-home"></i> Notifications</a></li>
How can I get the current page ID from the layout file, considering that it doesn't have a page model?