命名空间RoleExists不存在
本文关键字:不存在 RoleExists 命名空间 | 更新日期: 2023-09-27 17:54:43
基于这个链接,我创建了一个角色,但是我得到了以下错误:
命名空间testproject中不存在命名空间RoleExists
角色和我的代码如下:
namespace testproject.Roles
{
public partial class ManageRoles : System.Web.UI.Page
{
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;
}
}
}
角色有歧义:replace
if (!Roles.RoleExists(newRoleName)) // Create the role
System.Web.Security.Roles.RoleExists(newRoleName))