title: Read Azure AD login user details in ASP.net
body: <p>I'm implementing Azure AD login in asp.net (VS 2013).. <br/>
  I have successfully created sign-in in and sign-out parts..</p>
  
  <p>My sign -in and sign-out methods are like below.</p>
  
  <pre><code>public partial class Startup
  {      
  
      private static string clientId = ConfigurationManager.AppSettings["ida:ClientId"];
  
      private static string aadInstance = ConfigurationManager.AppSettings["ida:AADInstance"];
  
      private static string tenant = ConfigurationManager.AppSettings["ida:Tenant"];
  
      private static string postLogoutRedirectUri = ConfigurationManager.AppSettings["ida:PostLogoutRedirectUri"];
  
      string authority = String.Format(CultureInfo.InvariantCulture, aadInstance, tenant);
  
      public void ConfigureAuth(IAppBuilder app)
      {
          app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
  
          app.UseCookieAuthentication(new CookieAuthenticationOptions());
  
          app.UseOpenIdConnectAuthentication(
              new OpenIdConnectAuthenticationOptions
              {
                  ClientId = clientId,
                  Authority = authority,
                  PostLogoutRedirectUri = postLogoutRedirectUri,
                  Notifications = new OpenIdConnectAuthenticationNotifications
                  {
                      AuthenticationFailed = context =&gt; 
                      {
                          context.HandleResponse();
                          context.Response.Redirect("/Error?message=" + context.Exception.Message);
                          return Task.FromResult(0);
                      }
                  }
              });
      }
  }
  
  public void SignIn()
      {
  
          if (!Request.IsAuthenticated)
          {                HttpContext.Current.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = "/" }, OpenIdConnectAuthenticationDefaults.AuthenticationType);
          }
      }
  
      public void SignOut()
      {          
          HttpContext.Current.GetOwinContext().Authentication.SignOut(
              OpenIdConnectAuthenticationDefaults.AuthenticationType, CookieAuthenticationDefaults.AuthenticationType);
  
      }
  </code></pre>
  
  <p>But my problem is I can't assign logon user details like username ,Name to asp:Label ..</p>
  
  <p>I have tried </p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  
      {
          if (!Request.IsAuthenticated)
          {
              string UserName = HttpContext.Current.GetOwinContext().Authentication.User.Identity.Name.ToString();
          }
  
          if (Request.IsAuthenticated)
          {
  
              string UserName = HttpContext.Current.GetOwinContext().Authentication.User.Identity.Name.ToString();
  
          }
  
      }
  </code></pre>
  
  <p>This is very important to me.. anyone can help me..</p>