【发布时间】:2014-08-26 08:23:41
【问题描述】:
@Html.ActionLink("Edit Profile", "Index", "Profile")
我想要用户的用户名而不是“编辑个人资料”文本。此操作链接位于用户的共享页面中。
【问题讨论】:
标签: c# asp.net asp.net-mvc asp.net-mvc-3 asp.net-mvc-4
@Html.ActionLink("Edit Profile", "Index", "Profile")
我想要用户的用户名而不是“编辑个人资料”文本。此操作链接位于用户的共享页面中。
【问题讨论】:
标签: c# asp.net asp.net-mvc asp.net-mvc-3 asp.net-mvc-4
使用Identity.Name试试下面的代码
@Html.ActionLink(HttpContext.Current.User.Identity.Name, "Index", "Profile")
【讨论】:
如果username 在session 中,则执行以下操作:
@Html.ActionLink(Session["Username"].ToString(), "Index", "Profile")
【讨论】: