I am using asp.net 4.5 membership provider and roles,
problem is I'm trying to set up the creat user wizard to make the new member a certain role strait out the box. this is the code I am using.
Code
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
{
Roles.AddUsersToRole(CreateUserWizard1.UserName,"customer");
}
}
and the error log is giving me a error that I can not convert string and a best overload match, is there a easy way around this?
I just need to make it that all new users are customer.
Thank You
I believe the first parameter in the AddUsersToRole is a string array, hence the name of the method "Users", so try something like this:
string[] usersToAdd = new string[] { CreateUserWizard1.UserName };
Roles.AddUsersToRole(usersToAdd,"customer");
HTH
Phil
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.