-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();
}