473,398 Members | 2,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Question about Roles

Dear NG,

I plan to have a Datagrid in ASP.NET 2.0, with Users in Rows and Roles
in Columns, eg.

RoleA RoleB RoleC
Bob x x
Sue x x
Frank x x

The amount of Roles and Users is growing, so it shall grow
automatically. I want to click a checkbox, if a User is within a role
or not.

Now my questions:

- How can I get all roles/users automatically?
- How can I dynamically add/remove a users role?
- How can I automatically add roles?

Thank you very much for your help

Rudi

Jun 26 '06 #1
3 1007
Hi Rudi,

Much of the code you need has already been written by Microsoft for its own
Web site administration tool.

If you look in this folder:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ASP. NETWebAdminFiles

You'll find the source code for managing users and roles.

Good luck!

Ken
Microsoft MVP [ASP.NET]

<ru*********@asfinag.at> wrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
Dear NG,

I plan to have a Datagrid in ASP.NET 2.0, with Users in Rows and Roles
in Columns, eg.

RoleA RoleB RoleC
Bob x x
Sue x x
Frank x x

The amount of Roles and Users is growing, so it shall grow
automatically. I want to click a checkbox, if a User is within a role
or not.

Now my questions:

- How can I get all roles/users automatically?
- How can I dynamically add/remove a users role?
- How can I automatically add roles?

Thank you very much for your help

Rudi

Jun 26 '06 #2
1. Roles.GetAllRoles()

2. Roles.AddUserToRole("username", "rolename")
Roles.RemoveUserFromRoles("username", "rolename")

3. Roles.CreateRole("rolename")
That should do it.
Jun 26 '06 #3
Check out Peter Kellner's work on this topic [1]

--
<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

[1] http://peterkellner.net/archives/2006/01/09/24
<ru*********@asfinag.at> wrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
Dear NG,

I plan to have a Datagrid in ASP.NET 2.0, with Users in Rows and Roles
in Columns, eg.

RoleA RoleB RoleC
Bob x x
Sue x x
Frank x x

The amount of Roles and Users is growing, so it shall grow
automatically. I want to click a checkbox, if a User is within a role
or not.

Now my questions:

- How can I get all roles/users automatically?
- How can I dynamically add/remove a users role?
- How can I automatically add roles?

Thank you very much for your help

Rudi

Jun 27 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: V. Jenks | last post by:
Using forms authentication, can I control which pages and/or directories a user would have access to or is that only available with Windows authentication? Thanks!
1
by: Mike Logan | last post by:
Questions about Role Based Security in ASP.Net: I have a few questions about role based security in an ASP.Net application. Below are some points about our system: - We have a hierarchical...
1
by: Alex Nitulescu | last post by:
Hi. I have two questions, please: a) If I go DIRECTLY to Login, there's no Request.Params("ReturnURL"), and therefore RedirectFromLogin won't work, because it will try to go to a page named...
5
by: Steven Blair | last post by:
I am writing an application using the ASP.NET Configuration Roles and Users. The problem I have, in my C# I need to work out which type of user just logged in. I am currently using: string...
7
by: tshad | last post by:
I am trying to understand why I would use interfaces. In the following example for IPrinciple, I have the following code: ************************************************************ using...
0
by: Patrick.O.Ige | last post by:
As anybody here used the AspNetActiveDirectoryMembershipProvider with the SiteMap For example mapping the roles from Active Directory to the siteMapNode for security trimming? <siteMap...
3
by: Froefel | last post by:
I'm trying to modem a relationship with classes and I'm having trouble finding the correct design pattern. Maybe someone with more experience knows which pattern(s) I'm looking for. Here's an...
1
by: Derrick | last post by:
Morning, I am using the built in asp.net role/user/membership, etc. Have that all working. We have some internal users, and a bunch of external users. Is there any way to remove roles at...
25
by: Thomas R. Hummel | last post by:
I'm going to try to describe this situation as best as I can, but if anything is unclear please let me know. Some of this database was already in place before I arrived on the scene, and I don't...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.