473,698 Members | 2,873 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1021
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\Micr osoft.NET\Frame work\v2.0.50727 \ASP.NETWebAdmi nFiles

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

Good luck!

Ken
Microsoft MVP [ASP.NET]

<ru*********@as finag.at> wrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.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.GetAllRol es()

2. Roles.AddUserTo Role("username" , "rolename")
Roles.RemoveUse rFromRoles("use rname", "rolename")

3. Roles.CreateRol e("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*********@as finag.at> wrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.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
1662
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
417
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 roles system stored in a database. - We are also using Windows for authentication. - Page - Role relationships are also held in a database. - We have created a shared assembly for ease of use in applications.
1
1555
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 "Default", which in my case does not exist. Short of creating a "mandatory" Default page, what can I do ? RedirectFromLogin not only redirects me to whereever I came from, but it also creates a ticket - so how can I still use it if the redirection...
5
1374
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 role = Roles.GetRolesForUser(); This give me a string "Administrator" etc.
7
1218
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 System; using System.Collections; using System.Security; using System.Security.Principal;
0
1090
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 xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" > <siteMapNode url="~/default.aspx" title="Home" description="" roles="*"> <siteMapNode url="~/signup.aspx" title="Sign Up" description="" roles="?" /> <siteMapNode url="~/pwdreminder.aspx"...
3
1708
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 explanation of what I have and in which direction I'm thinking: CLASS DESIGN ============= 1. Generic class "Company" contains general company information (name, address, reference person, phone, etc...)
1
1210
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 run time, per request, based on the ip of the request? What I want to do is remove all the "admin" type roles for internet based users, only allow certain roles to apply if the request comes
25
2361
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 really have the buyin to change it. There is a table of certificates that a person can hold. A person may hold certificates of various types. I need to further group a person's certificates together so that (for example) renewal dates can be...
0
8611
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9031
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8904
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6531
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2341
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.