Mapping Windows users to custom application roles

mike55

Contributor
Joined
Mar 26, 2004
Messages
727
Location
Ireland
I am using Windows authentication, with authorization set to deny users="?"

I have set up three folders within my application, Admin, Staff, and All. I will have two roles, "admin" and "staff". The idea that I have is to prevent "admin" users from the Staff folder, and "staff" users from the Admin folder and that both "admin" and "staff" would have access to the All folder.

My problem is that I am unable to assign a custom role to individual windows users. I have tried to use the following code:
Code:
 Dim userIdentity As GenericIdentity = New GenericIdentity(HttpContext.Current.User.Identity.Name)

        Dim roles() As String = New String() {"admin"}
        Dim user As New GenericPrincipal(CType(userIdentity, IIdentity), roles)

However, it seems to only apply to the current page that I am on.

I am not allowed to use the auto role mechanism that comes with visual studio .net as I have to use a SQL Server 2000 database. Any suggestions?

Mike55.
 
IIRC the .Net membership and role providers only require SQL 2000 or higher - if the role provider would meet your needs you shouldn't need to use SQL 2005.
 
Back
Top