Take the 2-minute tour ×

I've looked for this for a while and the solutions look like they should work, it appears I'm doing it wrong.

I created an area for administering the CMS side called "manage" so if you go to:


it will give you a list of vinyards to manage using VinyardController built with the CRUD scaffold.

On the "front end" I have a browse controller and another VinyardController for viewing the details of a vinyard.

So someone goes to


it gives them a list of Vinyards, they click on one (here's the problem) I want it to go to


The route that I have is:

            new { controller = "VinyardController", action = "Details", area="root"}

Which is above the default route. Details is the method that displays the Vinyard details.

the HTML.actionlink I'm using is:

 @Html.ActionLink(item.Name, "Details", "vinyard" ,new { name = item.VinyardId, area="root" })

for some reason the a tag that's returned is: /Browse/Details?Length=7

On top of that when I try to browse to /vinyard/1 it gives me a 404.

Thanks for your help!

Update: If I browse to /vinyard/details/1 it works properly, except that I want it to eschew the /details/ part.

share|improve this question

2 Answers 2

Use this overload

public static MvcHtmlString ActionLink(
    this HtmlHelper htmlHelper,
    string linkText,
    string actionName,
    string controllerName,
    Object routeValues,
    Object htmlAttributes

So change your code to

                 new { name = item.VinyardId, area="root" },null)
share|improve this answer
That gave me just /browse/ for all of my entries. For some reason it's not differentiating between the different items other than the link name. –  Snowburnt Jul 27 '12 at 17:08
up vote 0 down vote accepted

Fixed it. Working with Shyju's modified action link, but I also removed the area property and had to fix up the map routing for it to work right.

My global.ascx now looks like this:

            new { controller = "Vinyard", action = "Details", id=UrlParameter.Optional},
            new[] { "MyNameSpace.Controllers" }

The two problems were: my controller name needed to be "Vinyard" not "VinyardController" and I needed to add the name space here and in my area route registration since I was using the same class names in both areas.

share|improve this answer

Your Answer


