0

I'm developing a .Net Core 5.0 webap and use links like this in a shared view:

<a class="dropdown-item" asp-controller="company" asp-action="service">Service</a>

This gives me a href like this (which is correct): http://examle.com/company/service

The problem arise when I'm on a spesific page like this: http://examle.com/company/service/5

The href changes accordingly, I get .../service/5 instead of just .../service.

How do I prevent the link to change without hardcoding the href in my view?

Heimdalingen
  • 91
  • 1
  • 3
  • https://stackoverflow.com/questions/32005426/how-can-i-hide-id-in-url-with-asp-net-mvc4 – Charlie Brown Apr 12 '21 at 10:26
  • The article you link to is about hiding information from the url, thats not relevant. I want the generated link in my menu to be the same nomatter which page you come from. – Heimdalingen Apr 12 '21 at 12:30

0 Answers0