none
请问在mvc中如何向母版页传值? RRS feed

全部回复

  •    @Html.ActionLink("你好," + Session["staffName"].ToString() + "!", "Index", "Home", routeValues: null, htmlAttributes: new { title = "Manage" })
    

    原来只要用session就可以了

    2018年12月24日 6:13
  • 你好,

    据我所知,如果你使用了Identity或者windows auth进行了登陆,那么我们这边可以直接通过User.Identity.Name来获取到用户的姓名。

    你可以直接在MVC的View中使用:

    <h2>登陆名:@User.Identity.Name</h2>


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    2018年12月24日 7:38