VB.Net/Windows System/User — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 16:40, 26 мая 2010
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
Get User Name
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("UserName: " & System.Environment.UserName)
End Sub
End Class
Is User Interactive
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("UserInteractive: " & System.Environment.UserInteractive)
End Sub
End Class