IIS Security Settings

Make sure to turn off Anonymous user access

Code for Code-Behind page.

Imports System.Security
Imports System.Security.Principal

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
         'Put user code to initialize the page here
         Dim pUser As WindowsPrincipal
        

         pUser = context.User
         Response.Write(pUser.Identity.Name)
        

         If pUser.IsInRole(WindowsBuiltInRole.Administrator) Then
                      Response.Write(" User is an Administrator <br>")
        Else
                      Response.Write(" User is not an Administrator <br>")
        End If
       

        If pUser.IsInRole("Administrator") Then
                      Response.Write(" Administrator ")
        End If
End Sub