【问题标题】:How do I get Absolute Root Links in ASP.NET MVC 2.0 beta Areas?如何在 ASP.NET MVC 2.0 beta 区域中获得绝对根链接?
【发布时间】:2010-12-22 05:38:01
【问题描述】:

登录链接如下:

<%= Html.ActionLink("Log On", "LogOn", "Account") %>

在浏览器中生成以下链接:

http://localhost:2300/Account/LogOn

但是,如果我切换到Area,例如Content,登录链接现在看起来像这样:

http://localhost:2300/Content/Account/LogOn

...当然失败了,因为Content 区域中没有AccountController

如何更改对 ActionLink 的调用,以使其生成 http://localhost:2300/Account/LogOn ?

【问题讨论】:

  • 你试过RouteLink吗?
  • 这是个好主意。让我看看。
  • 当你说“切换到一个区域”时,你的意思是你导航到一个区域,因此 ActionLink 会创建一个链接,假设它是区域“内容”?

标签: c# asp.net-mvc beta areas


【解决方案1】:

改用RouteLink

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-10-29
    • 1970-01-01
    • 2011-07-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-28
    相关资源
    最近更新 更多