I am using s#arp architecture 2.0 with asp.net mvc 3.0. The razor code in a master page looks like this:
@Html.ActionLink("Logout", "LogOff", "Users", new { style = "color:Blue;" })
For some reason the app does not produce the correct link anymore (to the action logoff of controller users) but rather points to the current controller for the action logoff. I have not changed anything. where do I have to dig to overcome this please?
The generated link looks like this:
CurrentControllerName/LogOff?Length=5
You are calling a wrong overload of the ActionLink helper. Here’s what you do:
It’s pretty obvious why this doesn’t produce the correct url. You are passing
"Users"which is a string value at the place where the helper expectsrouteValueswhich must represent an anonymous object.The correct overload is: