473,473 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

add role to new user from webpage

moaa
4 New Member
I have problem ,I have register new user by drag createuserwizard from login control
and it is save at ASPNET.mdf .and i create two role for the users.
I want to make this page when I create user choose too it's role
and save it at same database but i cann't
i want your help in it
thanks
Apr 16 '09 #1
6 2807
Frinavale
9,735 Recognized Expert Moderator Expert
I want to make this page when I create user choose too it's role
and save it at same database but i cann't
Why can't you?
What is the problem?
What have you tried so far?
Apr 16 '09 #2
maliksleo
115 New Member
@moaa
Dear please clerify yourself first that what you want.

What i understand is that you want the user to choose one of the two roles mentioned and with out choosing user will not be able to go forward.
Isnt it so?

if yes ten tell me i'll solve your problem or else clerify yourself

maliksleo
Apr 17 '09 #3
moaa
4 New Member
I create users && two roles (administrator&member) from asp.net conviguration
and it save at database called "aspnetdb.mdf" to make some pages that adminstrator only who use it ok!
and i make it, but the problem at when i create new user,he save it without it's role so,any new user can enter any page.
if I want to specify it's role make it from asp.net conviguration too.
but i don't want that
and when i drag CreateUserWizard from login control it haven't specify role
I hope to be understand my problem.
Apr 17 '09 #4
maliksleo
115 New Member
@moaa
i got your point
you need to make some changes first of all use checkbox list for your roles and on the coding side make it sure that your selected role is being stored in the database. How lets see:
Expand|Select|Wrap|Line Numbers
  1. *place checkboxlist from tool box to your aspx page and enter your roles in it like this
  2. <asp:CheckBoxList ID="CheckBoxList1" runat="server" RepeatDirection="Horizontal">
  3.             <asp:ListItem>Administrator</asp:ListItem>
  4.             <asp:ListItem>Member</asp:ListItem>
  5.         </asp:CheckBoxList>
  6.  
  7. *now in your coding side enter the selected value to the database through your query like
  8.  
  9. insert into "your database name" values ("your values" CheckBoxList1.selecteditem.text "this will insert the selected value in the database")
  10.  
  11.  
  12.  
one more thing that you will have to check that weather the user comming on some page is authorized or not for that you will need authentication. You can do it by using sessions
when some user login check that weather its Admin or member by the value stored in database under the column role.
next is you need to store that role in a session and match it on every session for authentication.
i think thats what you want
maliksleo
Apr 18 '09 #5
moaa
4 New Member
thanks,maliksleo
I did that but there is problem at sql statment i cann't write it because the database "aspnetdb.mdf" it have three tables
1-table1 have(RoleName,RoleId)
2-table2 have(UserName,UserId,.....)
3-table3 have(UserId,RoleId)
and to insert role of user it must take it's UserId from table2 and take it's RoleId from table1 and insert that at table3
i did dataset but i coudn't complete it
Apr 18 '09 #6
maliksleo
115 New Member
@moaa
Its realy simple

on your registeration of user check the role selected and insert it in database like this:
Expand|Select|Wrap|Line Numbers
  1. * here txtuname is your userid and chklistrole is your role checkboxes
  2. for table2
  3. sqltext = "inser into table2 values ('" & txtuname.text & "',....")"
  4. for table3
  5. sql1text = "insert into table3 values('" & txtuname.text & "','" & chklistrole.selecteditem.value & "')"
  6. note: you have to bind the roleid from database with the value property of chklistrole and text with the text property of chklistrole
  7.  
Apr 20 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: craig | last post by:
I am working on my first .NET development project that involves custom role-based security per the project requirements. This lead to a general design issue this week that really caused us some...
4
by: hazz | last post by:
If I successfully run a VS.NET app which includes the following; ************************** APP 1 **************************** m_iIdnt = new...
2
by: Jesper Stocholm | last post by:
I have implemented role-based security within my ASP.Net application. However, it seems the role is not passed to the authentication ticket I create. I want to use it to display/hide some...
0
by: Ammar Mujeeb via .NET 247 | last post by:
hi, I want to use one time user login to work for two differentprojects in same domain. Both projects used Form Authenticationin Role Based Security while the web.config file restrict theusers folder...
8
by: Mark White | last post by:
Hey everyone I'm having a great deal of problems finding this information through google and yahoo, so I turn to you on this. I have a Windows app running on XP. I am able to caputre the...
0
by: ferherra | last post by:
Hi, Hope someone can help... I databind my gridview (asp.net 2.0) like this: GridView1.DataSource = Membership.GetAllUsers(); (MembershipUserCollection) GridView1.DataBind(); In the...
4
by: cybertoast | last post by:
i seem to have some misunderstanding about how roles work in sql server 2005. i see that i can add a role to a database (dbname->->properties->permissions->. THis allows me to add either users or...
3
by: RedHair | last post by:
I use the Form Authentication and Role base security to secure one ASP.NET 3.5 appication. Below are security settings in web.config <location path="testAdmin.aspx"> <system.web>...
2
by: Anthony Smith | last post by:
I have a user object that is set when a user logs in. There are also permissions that I get about the user from a web service. Currently I take the results from those web services and store them as...
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
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...
1
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.