-1

I would like to restrict user's access on my website based on the the User Identity and I used following code its works fine in Visual Studio but when I am publishing into IIS sending userIdentity= NULL to Database.

Dim httpContext__1 As HttpContext = HttpContext.Current
Dim winIdentity As System.Security.Principal.WindowsIdentity = DirectCast(httpContext__1.User.Identity, WindowsIdentity)
Dim userIdentity As String = winIdentity.Name

hasAccess = GetUserFromDB(userIdentity)
If hasAccess Then
    ' restrictions on 
Else
End If
ABM Abdul Muttalib
  • 195
  • 1
  • 2
  • 13

1 Answers1

0

We need to be sure that Windows Authentication is enabled and Anonymous Authentication is disabled.Please See This Link

ABM Abdul Muttalib
  • 195
  • 1
  • 2
  • 13