T4MVC: Empty link on shared view when controller is in an area

177 views Asked by At

I have a shared view which contains a link to an action on a top-level controller.

I render this view from two controllers: one is in an area, and the other isn't.

When the following is rendered after being called from the controller inside the area, it's empty.

@Html.ActionLink("Forgotten your password?", MVC.Login.Index())

However, when it's called from the controller which isn't in the area then it populates the link correctly.

And just to be clear, the link which should be generated, "login/index", is not in an area.

I've tried adding

new { Area = "" }

to the ActionLink call but this doesn't help.

I believe that either T4MVC is trying to find a Login.Index action within the area, or it's passing the correct information to ActionLink which is then doing something I didn't expect.

So how do I instruct T4MVC or ActionLink to render a link to the top-level controller/action?


UPDATE:

I've found that even if I don't use T4MVC and write out the ActionLink call like so:

@Html.ActionLink("Forgotten your password?", "index", "login", new { Area = "" })

then it still renders an empty link.

0

There are 0 answers