Strongly typed Html.ActionLink<T>() helper extension from MVC Futures doesn't do well with areas

I noticed some odd behaviour when using the strongly typed HtmlHelper.ActionLink() extension method from ASP.NET MVC 2 Futures. When I use it to link to a controller in an area I have to use the following attribute on this controller

[ActionLinkArea("SomeArea")]

It links properly to the actions of the controller located in SomeArea from the default area. The problem is when I want to link back to a Controller action located in the default area from within SomeArea. The link appears with "/SomeArea/" prefix. The workaround I use is:

[ActionLinkArea("")]

on the controller on all controllers that are located in the default area (using inheritance).

This seems odd because in my opinion that should be the default behavior of this method. Using .NET Reflector on this extension method I noticed that the error lies here:

return helper.RouteLink(linkText, routeValuesFromExpression, new RouteValueDictionary(htmlAttributes));

So it's actually the default behaviour of the HtmlHelper.

Answers


Known issue in MVC 2 Futures - same underlying cause as http://forums.asp.net/p/1535698/3732346.aspx.

From our internal database, if you wanted to patch the file and recompile MVC Futures yourself:

The bug is in LinkBuilder.cs, line 21. The method call GetVirtualPath() should be GetVirtualPathForArea().


Need Your Help

Refreshing a JList after adding element from another Frame

java arrays swing jlist

I'm having an urgent issue concerning the refresh of the JLists. Been looking for some days, didn't found and forget to search further >&lt; and now I'm in a hurry with it.

Rails scope checking for no associations

ruby-on-rails

I have a Category model where a category may have some subcategories (category.categories). I want a scope that gives me all Categorys that have no subcategories.