-1
我是網絡開發和.NET的新手。我有一個使用C#編寫的ASP.NET網站。我應該如何顯示當前用戶的全名而不是使用會話的用戶名?請幫幫我。這是代碼。後面的登錄頁面如何顯示顯示名稱而不是用戶名c#
代碼: -
System.Security.Principal.WindowsPrincipal username = System.Threading.Thread.CurrentPrincipal as System.Security.Principal.WindowsPrincipal;
string userName = username.Identity.Name;
if (username.Identity.IsAuthenticated)
{
Session["logged"] = userName;
agentname.Text = Session["logged"].ToString();
}
else
{
agentname.Text = "You are not loggd in please logine first ";
}
if (Session["logged"] == null)
{
agentname.Text = "You are not loggd in please login first ";
}
else
{
agentname.Text = Session["logged"].ToString();
}