can't access to an extension method with UrlHelper parameter in controller! Vice versa in view have

Posted by Sadegh on Stack Overflow See other posts from Stack Overflow or by Sadegh
Published on 2010-04-06T18:09:21Z Indexed on 2010/04/06 18:13 UTC
Read the original article Hit count: 218

why defined extension method with UrlHelper don't added in Url.EXTENSIONMETHOD when i want to use it in controller! but i have access to it in view?

public static string Home(this UrlHelper helper)
{
    return helper.RouteUrl("ABC", new { controller = "ABC", Action = "Default" });
}

i haven't access:

public ActionResult Default()
{
    return Redirect(Url.Home());
}

i have access in view:

<a href="<%=Url.Home() %>" title="Hello">Hello</a>

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about extension-methods