home *** CD-ROM | disk | FTP | other *** search
- Imports System.Web.Security
- Imports System.Security.Principal
-
- Public Class WebForm1
- Inherits System.Web.UI.Page
- Protected WithEvents lblUserInfo As System.Web.UI.WebControls.Label
-
- #Region " Web Form Designer Generated Code "
-
- 'This call is required by the Web Form Designer.
- <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
-
- End Sub
-
- 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
- ' this code shows how you can learn the user identity
-
- ' retrieve user name and authentication method
- Dim msg As String
- If Not User.Identity.IsAuthenticated Then
- msg = "Unauthenticated user"
- Else
- msg = "User name = " & User.Identity.Name & "<br />"
- msg &= "Authentication type = " & User.Identity.AuthenticationType & "<br />"
- End If
-
- ' this code retrieve additional information if user was
- ' authenticated by using Windows authentication mode
-
- If User.Identity.IsAuthenticated And TypeOf User.Identity Is WindowsIdentity Then
- Dim wi As WindowsIdentity = DirectCast(User.Identity, WindowsIdentity)
- msg &= "Anonymous = " & wi.IsAnonymous & "<br />"
- msg &= "Guest = " & wi.IsGuest & "<br />"
- msg &= "System = " & wi.IsSystem & "<br />"
-
- Dim wp As WindowsPrincipal = DirectCast(User, WindowsPrincipal)
- If wp.IsInRole(WindowsBuiltInRole.Guest) Then
-
- End If
- End If
-
- ' display other information about the current ASP.NET process
-
- Dim pi As ProcessInfo = ProcessModelInfo.GetCurrentProcessInfo
- msg &= "ProcessID = " & pi.ProcessID.ToString & "<br />"
- msg &= "Status = " & pi.Status.ToString & "<br />"
- msg &= "StartTime = " & pi.StartTime & "<br />"
- msg &= "Age = " & pi.Age.ToString & "<br />"
- msg &= "RequestCount = " & pi.RequestCount & "<br />"
- msg &= "PeakMemoryUsed = " & pi.PeakMemoryUsed.ToString & "<br />"
- lblUserInfo.Text = msg
-
- End Sub
-
- End Class
-