I encountered a very weird behaviour in my project today. So I am working on a website which has an admin view an a common user view. The pages are stored in a folder named "Admin" and a folder named "User" under the folder "Views"
I started only setting up functionality for the Admin pages, so I never realized that my UserController didn't work. It always routed me to Admin/Somepage instead of User/Somepage.
After some testing I found the following problem:
If I use
@Html.ActionLink("Admin", "AdminHome", "Admin")
@Html.ActionLink("User", "UserHome", "User")
everything works just fine.
But as soon as I add a class to the link for example
@Html.ActionLink("User", "UserHome", "User", new { class= "someClass" })
it stops working. When I now click on the Link to the user homepage it routes to Admin/UserHome instead of User/UserHome and obviously can't find the page.
Why is that? Anyone ever experienced this?
I mean I can still wrap it in another div and add the class there. I just want to know if there is a reason behind this behaviour.