After reading this post, I came up with a method of my own:
My method is similar but has one major flaw. Let's imagine we have 3 links:
Home, About, and Contact.
We also have 4 controllers with default Index actions:
HomeController, AboutController, ContactController, and BiographyController.
In the content of the About page, there is a link to the Biography page, which calls the Index action in the Biography controller.
However, when clicking on the biography link, I want the About page to remain selected as it belongs to the "About" section.
Most of the solutions I found online do not address this crucial issue.
The solution I devised does not require using sessions or adding messy code in Views. All we need are these lines of code:
<%= Html.ActionMenuItem("Home", "Index", "Home") %>
<%= Html.ActionMenuItem("About", "Index", "About") %>
<%= Html.ActionMenuItem("Contact", "Index", "Contact") %>
Since the solution to this problem is quite detailed, I have shared it on my blog: