Ask a Question related to ASP.NET Security, Design and Development.
-
Ivan Gibbs #1
Get User Roles?
In C#, I want to log in a user who has a specific role.
The role was originally "Cashier". However, now
the "Cashier" can be prefixed with anything, such
as "LS_Cashier". Since the role name is not known any
more, how can the user be logged in?
I have been working on getting all the role names and
checking if any contain "Cashier", but I have not found a
way to get a list of the current roles. There was some
discussion of TokenGroups, but this has not lead to a
solution for C#.
Any help would be appreciated.
Ivan Gibbs Guest
-
Can user roles by transferred to new web server?
Our ISP moved our files to a new web server since we were running out of room on their old server. However, our user roles did not get transferred.... -
Backing up User Roles and other
I have Contribute 3. From my research, the _mm/Contribute.xml and !@#$%.csi are supposed to contain the User Roles and other config data. This is... -
user roles corrupted
Why all the created user roles can disappeare in 2-3 days and I have to recreate all keys again? Is _mm folder should be displayed in Dreamweaver... -
Switch User Roles
Hi all, Is there any way to switch from Administrator role to normal user role without deleting settings?? Thanks. Kevin. -
User Roles - Global.asax
I have the following code in global.asax, which picks up a logged in users roles from a db. if (not(HttpContext.Current.User is Nothing))... -
Joe Kaplan \(MVP - ADSI\) #2
Re: Get User Roles?
What is the type on the IPrincipal that you are checking? If it was a
WindowsPrincipal, the roles would be Windows groups and would be prefixed
with a domain or machine name like domain\cashier. If it isn't a
WindowsPrincipal, then it is likely some other type of IPrincipal that is
created in your code somewhere. If so, then you can probably add a Roles
property to the type and then enumerate them that way.
If it is a WindowsPrincipal, then there are a few options for getting the
groups. The Token property of WindowsIdentity in the Identity object can be
used to call into unmanaged code to get the token groups as SIDs. Then,
more unmanaged code can be used to convert them to names.
If you provide more details, we can help more.
Joe K.
"Ivan Gibbs" <anonymous@discussions.microsoft.com> wrote in message
news:0aeb01c4f382$5beb93c0$a601280a@phx.gbl...>
> In C#, I want to log in a user who has a specific role.
> The role was originally "Cashier". However, now
> the "Cashier" can be prefixed with anything, such
> as "LS_Cashier". Since the role name is not known any
> more, how can the user be logged in?
>
> I have been working on getting all the role names and
> checking if any contain "Cashier", but I have not found a
> way to get a list of the current roles. There was some
> discussion of TokenGroups, but this has not lead to a
> solution for C#.
>
> Any help would be appreciated.
>
>
Joe Kaplan \(MVP - ADSI\) Guest
-
Paul Glavich [MVP ASP.NET] #3
Re: Get User Roles?
Have a look at one of my articles located here
[url]http://aspalliance.com/articleViewer.aspx?aId=553&pId=2[/url] which is the second
page in the article and contains a small routine to look at the roles
contained within a Windows principal object. It will allow you to extract
them into a string array and evaluate them from there.
--
- Paul Glavich
ASP.NET MVP
ASPInsider ([url]www.aspinsiders.com[/url])
"Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan@removethis.accenture.com> wrote
in message news:%23w5ZyH68EHA.3260@TK2MSFTNGP10.phx.gbl...be> What is the type on the IPrincipal that you are checking? If it was a
> WindowsPrincipal, the roles would be Windows groups and would be prefixed
> with a domain or machine name like domain\cashier. If it isn't a
> WindowsPrincipal, then it is likely some other type of IPrincipal that is
> created in your code somewhere. If so, then you can probably add a Roles
> property to the type and then enumerate them that way.
>
> If it is a WindowsPrincipal, then there are a few options for getting the
> groups. The Token property of WindowsIdentity in the Identity object can> used to call into unmanaged code to get the token groups as SIDs. Then,
> more unmanaged code can be used to convert them to names.
>
> If you provide more details, we can help more.
>
> Joe K.
>
> "Ivan Gibbs" <anonymous@discussions.microsoft.com> wrote in message
> news:0aeb01c4f382$5beb93c0$a601280a@phx.gbl...>> >
> > In C#, I want to log in a user who has a specific role.
> > The role was originally "Cashier". However, now
> > the "Cashier" can be prefixed with anything, such
> > as "LS_Cashier". Since the role name is not known any
> > more, how can the user be logged in?
> >
> > I have been working on getting all the role names and
> > checking if any contain "Cashier", but I have not found a
> > way to get a list of the current roles. There was some
> > discussion of TokenGroups, but this has not lead to a
> > solution for C#.
> >
> > Any help would be appreciated.
> >
> >
>
Paul Glavich [MVP ASP.NET] Guest



Reply With Quote

