我在我的Asp.net mvc Web應用程序中使用@ User.Identity.Name。這顯示爲一旦部署了Azure站點上的本地和[email protected]上的域\用戶。而不是使用@ User.Identity.Name,有什麼辦法可以使它在本地和服務器上是唯一的。由於此衝突,我有許多密碼破譯區域。User.Identity.Name在發佈到Azure之前和之後不同
我將Azure Active Directory身份驗證添加到Azure上承載的應用程序。
using (var context = new PrincipalContext(ContextType.Domain))
{
var principal = UserPrincipal.FindByIdentity(context, User.Identity.Name);
var displayName = principal?.DisplayName;
}
這顯示名顯示在本地和公佈一次到Azure它像空「」。在發佈之後,在Azure服務器上顯示顯示名稱的最佳方式是什麼?