howto get the user id from a FormsAuthentication page in asp.net MVC?

前端 未结 1 1064
陌清茗
陌清茗 2021-01-29 05:33

i made a webpage which use FormsAuthentication. now i need to get the user id of the user (if a user is logged in)

how to get these? i tryed to access it via the F

相关标签:
1条回答
  • 2021-01-29 05:55
    if (HttpContext.Current.User.Identity.IsAuthenticated)
    {
        var id = HttpContext.Current.User.Identity.Name;
        // Do stuf...
    }
    
    0 讨论(0)
提交回复
热议问题