Posted on: 4/10/2015 4:27:27 PM | Views : 685

I am not sure if this is the right forum.
Have APS.NET application. Need to find out if the current user is in one of two groups.  Try several methods from the web, they will work in VS 2010, but not when I up loaded the application to the web server.  The following is the latest code, get error message when call the application is "Error Code 91 - Object reference not set to an instance of an object" when the line of code Dim groups = user.GetGroups().
Public Sub InGroup() btnChangeExamStatus.Enabled = False btnChangeExamStatus.Visible = False Dim userName = WindowsIdentity.GetCurrent.User.ToString() Dim DC = New PrincipalContext(ContextType.Domain) ' find a user in the domain Dim user = UserPrincipal.FindByIdentity(DC, userName) Dim groups = user.GetGroups() Dim groupNames = From g In groups Select g.Distinguis ...

Go to the complete details ...