Fix for #246 - ActionLink generating wrong urls
There's an overload that's missing from ActionLink but is present on url helper, making it very easy to mistakenly pass the wrong data. In the case of #246, the controller name is treated as the route-values and the route-values treated as html attributes, leading to the wrong link being generated.
This commit is contained in:
parent
5810215306
commit
f34ed467e4
|
|
@ -71,6 +71,24 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
htmlAttributes: null);
|
||||
}
|
||||
|
||||
public static HtmlString ActionLink<TModel>(
|
||||
[NotNull] this IHtmlHelper<TModel> helper,
|
||||
[NotNull] string linkText,
|
||||
string actionName,
|
||||
string controllerName,
|
||||
object routeValues)
|
||||
{
|
||||
return helper.ActionLink(
|
||||
linkText,
|
||||
actionName,
|
||||
controllerName,
|
||||
protocol: null,
|
||||
hostname: null,
|
||||
fragment: null,
|
||||
routeValues: routeValues,
|
||||
htmlAttributes: null);
|
||||
}
|
||||
|
||||
public static HtmlString ActionLink<TModel>(
|
||||
[NotNull] this IHtmlHelper<TModel> helper,
|
||||
[NotNull] string linkText,
|
||||
|
|
|
|||
Loading…
Reference in New Issue