Search code examples
vb.netasp.net-membershipsqlmembershipprovider

Membership Roles.GetUsersInRole not working for me


Dim usersInRole As String() = Roles.GetUsersInRole("HR_Base_Role")
Dim Myusers As New MembershipUserCollection

For Each UserName As String In usersInRole
    Myusers.Add(Membership.GetUser(UserName))
Next
ComboBox2.DataSource = Myusers

The code above throws a "Specified method is not supported." exception on the first line. Any one knows what am doing wrong here?


Solution

  • Membership, Roles and Profiles are all ASP.Net technologies and require a properly configured web site.

    In .NET 3.5 these facilities were extended to support use from desktop applications via Application Services, but note that a properly configured ASP.Net website is still the source of the data/services.

    To properly utilize these facilities, please ensure familiarity with the linked information.

    Reference: http://msdn.microsoft.com/en-us/library/bb547119(VS.90).aspx