I have the following extension method:
public static MvcHtmlString GenerateBodyCellContentFor(
this HtmlHelper helper,
Goal goal,
GoalProperty property)
{
if (property == GoalProperty.Name)
{
return LinkExtensions.ActionLink(
helper,
goal.Name,
"Show",
new
{
goalId = goal.GoalId
});
}
// rest of the code irrelevant
}
This works as expected and generates the following link:
http://localhost:54913/Goal/Show?goalId=19013
Due to certain circumstances, I now need to explicitly specify the controller name. So I changed the method to the following:
public static MvcHtmlString GenerateBodyCellContentFor(
this HtmlHelper helper,
Goal goal,
GoalProperty property)
{
if (property == GoalProperty.Name)
{
return LinkExtensions.ActionLink(
helper,
goal.Name,
"Show",
"Goal", // the only change in code
new
{
goalId = goal.GoalId
});
}
// rest of the code irrelevant
}
And the result, to my astonishment, is this:
http://localhost:54913/Goal/Show?Length=4
I tried removing and adding the controller parameter three times, because I could not believe that this actually happens. This is the ONLY change and it causes this behavior.
The length parameter is equal to controller name's length (just checked with a different string).
Do you have any idea what might be going on?