VB.Net by API/System.Security.Principal/WindowsIdentity — различия между версиями

Материал из VB Эксперт
Перейти к: навигация, поиск
м (1 версия)
 
м (1 версия)
 
(нет различий)

Текущая версия на 12:49, 26 мая 2010

WindowsIdentity.GetCurrent

  
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


WindowsIdentity.IsGuest

  
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