开发者

Add User To Role in Membership Provider

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜