【发布时间】:2016-08-25 22:29:16
【问题描述】:
我使用的标记如下。
@Html.ActionLink(@User.Identity.Name, "LogOut", "Account")
现在,我需要在锚点内添加一个跨度,因为我想使用 Bootstrap 中的字形。就我的 googlearch 而言,没有办法使用上面的帮助程序来指定它。因此,我将其重新设计为显式 HTML,如下所示。
<a href="~/Account/LogOut">
<span class="glyphicon glyphicon-log-out"></span>
<span>@Global.LogOut @User.Identity.Name</span>
</a>
它可以工作但链接并不总是指向与第一个示例相同的地址。这是因为我首先有 en/ 或 se/ 等语言。基于 MVC 路由时,语言前缀保持不变,但在显式指定 URL 时会丢失。
如何指定对特定操作方法的调用?
【问题讨论】:
-
使用
<a href = "@Url.Action("LogOut", "Account")">....`
标签: c# html asp.net-mvc