Imports System
Imports System.Security.Principal
Imports System.Threading
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents contextName As System.Web.UI.WebControls.TextBox
Protected WithEvents contextIsAuth As System.Web.UI.WebControls.TextBox
Protected WithEvents contextAuthType As System.Web.UI.WebControls.TextBox
Protected WithEvents threadName As System.Web.UI.WebControls.TextBox
Protected WithEvents threadIsAuthenticated As System.Web.UI.WebControls.TextBox
Protected WithEvents threadAuthenticationType As System.Web.UI.WebControls.TextBox
Protected WithEvents windowsName As System.Web.UI.WebControls.TextBox
Protected WithEvents windowsIsAuth As System.Web.UI.WebControls.TextBox
Protected WithEvents windowsAuthType As System.Web.UI.WebControls.TextBox
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim id As IIdentity = HttpContext.Current.User.Identity
If id Is Nothing Then
contextName.Text = id.Name
contextIsAuth.Text = id.IsAuthenticated.ToString()
contextAuthType.Text = id.AuthenticationType
End If
id = Thread.CurrentPrincipal.Identity
If id Is Nothing Then
threadName.Text = id.Name
threadIsAuthenticated.Text = id.IsAuthenticated.ToString()
threadAuthenticationType.Text = id.AuthenticationType
End If
id = WindowsIdentity.GetCurrent()
windowsName.Text = id.Name
windowsIsAuth.Text = id.IsAuthenticated.ToString()
windowsAuthType.Text = id.AuthenticationType
When I wrote that last post "This will tell you who is currently logged into the machine", your big post "for anyone who is interested" had not yet appeared on this thread;
So my post just ended up repeating what you had already posted, I think the two posts must have been made almost simultaneously.
thank you
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.