Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
4.29/5 (4 votes)
See more:
how to solve the problem with this type of code?

C#
string newRoleName = RoleName.Text.Trim();

            if (!Roles.RoleExists(newRoleName))
                // Create the role
                Roles.CreateRole(newRoleName);

            RoleName.Text = string.Empty;




Underlined words get the following error

Are you missing an assembly reference ?
Posted
Comments
Kenneth Haugland 1-Aug-12 9:51am    
What? What is roles? HAve you reated a custom class and want to know what?
Jovan P 1-Aug-12 10:09am    
I walk through this tutorial http://www.asp.net/web-forms/tutorials/security/roles/creating-and-managing-roles-cs
[no name] 1-Aug-12 9:52am    
Did you add a reference to System.Web.Security?
Jovan P 1-Aug-12 10:06am    
Yes
[no name] 1-Aug-12 10:08am    
Did you add the using statement at the top of your file?

1 solution

I hope following link will help you:
http://www.asp.net/web-forms/tutorials/security/roles/creating-and-managing-roles-cs[^]

Please carefully read following items:
#Step 3: Examining the Roles API
#Step 4: Creating New Roles

Good luck
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900