首页 文章

在MVC中使用AD Identity Access获取用户信息

提问于
浏览

2 回答

  • 1
    public ActionResult Index()
        {            
          ClaimsPrincipal cp = ClaimsPrincipal.Current;
          string fullname = 
                 string.Format("{0} {1}", cp.FindFirst(ClaimTypes.GivenName).Value,
                 cp.FindFirst(ClaimTypes.Surname).Value);
          ViewBag.Message = string.Format("Dear {0}, welcome to the Expense Note App", 
                            fullname);
          return View();
         }
    
  • 0

    Microsoft帐户(AKA LiveID)不向ACS提供用户的个人信息或电子邮件,您只能获得代表用户的ID . Google ID会为您提供用户名和电子邮件 .

    按设计,不能改变 .

相关问题