T4MVC adding current page controller to action link

Posted by Mike Flynn on Stack Overflow See other posts from Stack Overflow or by Mike Flynn
Published on 2012-10-26T16:58:42Z Indexed on 2012/10/26 17:00 UTC
Read the original article Hit count: 335

Filed under:
|

I have the following ActionLink that sits in the home page on the register controller (Index.cshtml)

@Html.ActionLink("terms of service", Url.Action(MVC.Home.Terms()), null, new  { target="_blank" })

Generating the following URL. Why is "register" being added to it? It's as if the link within the Register page which has it's own controller is preappending the register controller to any link in that view?

http://localhost/register/terms-of-service

    routes.MapRoute(
        "Terms",
        "terms-of-service",
        new { controller = "Home", action = "Terms" }
    );

public partial class HomeController : SiteController
{
    public virtual ActionResult Terms()
    {
        return View(new SiteViewModel());
    }

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about T4MVC