Current User Identity : User « Windows System « VB.Net






Current User Identity

Current User Identity
Imports System.Windows.Forms
Imports System.Security.Principal
Imports System.Security.Permissions

Public Class SymEnc

    Public Shared Sub Main(ByVal CmdArgs() As String)
        Dim objIdentity As WindowsIdentity = WindowsIdentity.GetCurrent
        Dim objPrincipal As New Security.Principal.WindowsPrincipal(objIdentity)
        Console.WriteLine(objPrincipal.Identity.IsAuthenticated.ToString())
        Console.WriteLine(objIdentity.IsGuest.ToString())
        Console.WriteLine(objIdentity.ToString())
    End Sub

End Class



           
       








Related examples in the same category

1.Is User InteractiveIs User Interactive
2.Get User NameGet User Name