开发者

Add User To Role in Membership Provider

开发者 https://www.devze.com 2023-03-18 09:55 出处:网络
I have gone through a video tutorial regarding Asp.net Membership Provider in which he has done his coding in VB. The same code i used in C# but at this point i am getting an error as The best overloa

I have gone through a video tutorial regarding Asp.net Membership Provider in which he has done his coding in VB. The same code i used in C# but at this point i am getting an error as The best overloaded method match for开发者_C百科 'System.Web.Security.Roles.AddUsersToRole(string[], string)' has some invalid arguments

This is what i have written with reference to that video can any one tell what's going wrong

Roles.AddUsersToRole(User.Identity.Name, ListBox1.SelectedValue);


You shoud use :

Roles.AddUserToRole

instead of :

Roles.AddUsersToRole


Roles.AddUsersToRole(new string[] {User.Identity.Name}, ListBox1.SelectedValue);

this should to the trick


I think, in fact, that this is needed:

Roles.AddUsersToRole(new string[] {User.Identity.Name}, ListBox1.SelectedValue);

based on the method signature shown.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号