窗口登录用户名在asp.net中的窗口身份验证中

时间:2012-07-09 06:34:36

标签: asp.net vb.net

其实我想显示登录窗口的用户。但是当我写这个参数并在内联网上运行时

WindowsIdentity.GetCurrent().Name;

然后显示

  

NT AUTHORITY \ IUSR

我想显示用户名。当我运行VB软件时,它显示窗口用户名。

1 个答案:

答案 0 :(得分:2)

您应该使用User.Identity.Name

If User.Identity.IsAuthenticated Then
    Label1.Text = User.Identity.Name
Else
    Label1.Text = "Anonymous user"
End If
相关问题