Reputation: 53
i been studying in how to add role this website http://www.asp.net/web-forms/tutorials/security/roles/creating-and-managing-roles-cs
i lost at step 4. Creating New Roles..
protected void CreateRoleButton_Click(object sender, EventArgs e)
{
string newRoleName = RoleName.Text.Trim(); if (!Roles.RoleExists(newRoleName)) // Create the role
Roles.CreateRole(newRoleName); RoleName.Text = string.Empty;
}
after i done do what it said .. i got this Error :The name 'Roles' does not exist in the current context..
What did i miss?
Upvotes: 0
Views: 61
Reputation: 731
Did you follow, Step 2: Specifying and Configuring the Roles Framework Provider and Step 3: Examining the Roles API ? Please ensure that your codebehind references System.Web.Security namespace.
Above steps make sure that all configuration are taken place to implement role-based authentication.
For more information, see this article which explains full configuration for roles impelementation.
Upvotes: 1