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

时间:2014-02-21 06:59:45

标签: c# asp.net-mvc-4 azure

2 个答案:

答案 0 :(得分: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();
     }

答案 1 :(得分:0)

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

按设计,不能更改。

相关问题