For anyone who is interested:
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
End Sub
End Class