Anchor hash in Razor ASP.NET web pages

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Anchor hash in Razor ASP.NET web pages



I use ASP.NET core Web application (web pages) .NET core version 2.1. In the razor page, I have a link to a specific div element on another site (in the same project), like so:


<a href="/MyAspPage#idOfDiv">Link</a>



However, the Intellisense complains (and rightfully so), that there is no /MyAspPage in wwwroot. After the build, this works just fine, because the link is valid of course.


/MyAspPage


wwwroot



Is there a way to use the asp-page tag helper or any other tag helper to link to a hash anchor on another site? Such as (following does not work of course):


asp-page


<a asp-page="/MyAspPage" asp-anchor="idOfDiv">Link</a>



Edit: What I want is a tag helper which would produce the exact link as above when I used the href. The link is valid and works after build because the application takes care of it.


href









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS