Basic Auth - Role Based security
From: Alan Harling (aharling_at_legis.state.il.us)
Date: Wed, 17 Nov 2004 08:28:51 -0600
I am having a problem with role-based security in an ASP.NET application.
Web Server - IIS 6.0, Win2K3
Domain - W2K
When I browse to the web site I get the login dialog. I type in my useid/password and I get authenticated fine. The next thing I do in the application is to check to see if the person that was just authenticated has access to this application. So, I use the IsInRole function with a known group to see if I get back a true or false and I always get false. I have created a test harness that is testing just the piece that is not working and I have included it below.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.lblUserName.Text = User.Identity.Name()
Me.lblAuthType.Text = User.Identity.AuthenticationType()
Me.lblIsAuth.Text = IIf(User.Identity.IsAuthenticated, "True", "False")
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.lblInGroup.Text = IIf(User.IsInRole(Me.txtGroup.Text), "True", "False")
I am entering the group name in the format: "domain\group". I have tried groups that are setup as local and global and neither has worked.
Any help would be apprcieated.....Thanks.