Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8351049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:30:57+00:00 2026-06-09T08:30:57+00:00

How do I connect to the membership database to retrieve a list of user

  • 0

How do I connect to the membership database to retrieve a list of user accounts? For example I have this to connect to my profiles:

    Private db As UserProfileDbContext = New UserProfileDbContext

    '
    ' GET: /UserProfile/

    Function Index() As ViewResult
        Return View(db.UserProfiles.ToList())
    End Function

There doesn’t seem to be any user account database context specified in the account model. Should I create one, or is there a better way to retrieve all user accounts into a list like above?

Edit:

I have this code in the controller:

'
' GET: /Account/ViewRegistries

Function ViewRegistries() As ViewResult
    Return View(Membership.GetAllUsers().Cast(Of MembershipUser).ToList)
End Function

My view:

@ModelType IEnumerable(Of MyBlog.RegisterModel)

@Code
    ViewData("Title") = "Index"
End Code

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th>
            UserId
        </th>
        <th>
            CompanyId
        </th>
        <th></th>
    </tr>

@For Each item In Model
    Dim currentItem = item
    @<tr>
        <td>
            @Html.DisplayFor(Function(modelItem) currentItem.UserName)
        </td>
        <td>
            @Html.DisplayFor(Function(modelItem) currentItem.Company)
        </td>
    </tr>
Next

</table>

But it produces an error:

The model item passed into the dictionary is of type
‘System.Collections.Generic.List1[System.Web.Security.MembershipUser]',
but this dictionary requires a model item of type
'System.Collections.Generic.IEnumerable
1[MyBlog.RegisterModel]’.

How can I fix it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:30:58+00:00Added an answer on June 9, 2026 at 8:30 am

    You could use the membership provider:

    Membership.GetAllUsers()
    

    Once you register users this will return the list of all users in the database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a database server running SQL Server 2008 and we connect using Windows
In my web.config file, I have a connection string to connect my development database.
I connect to a database: void connectToDataBase(){ dataManager_ref = new DataBaseConfigurationManager(); try { connection
I have an ASP.NET application that uses the membership functionality. I connect to a
I have a website that connects to SQLServer Express database files for Membership and
I have got an established database, (attached mdf file) called Speakom. I Executed this
I have been trying to get this code to update, and it just will
I connect to SQL Server database and grab a DataSet of the result with
I connect to a mysql database using pymysql and after executing a request I
I'm using Facebook Connect along with the Facebook Graph API to fetch user's email

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.