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

  • Home
  • SEARCH
  • 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 646945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:40:08+00:00 2026-05-13T21:40:08+00:00

I am wondering if the aspnet_Users table is always sorted (by UserName) even if

  • 0

I am wondering if the aspnet_Users table is always sorted (by UserName) even if I add new users which are alphabetically between two already existing users.

I’ve noticed that the method Membership.GetAllUsers() always seems to return a sorted collection of MembershipUsers.

Also when I look into SQL Server Management Studio and run a simple SQL query without ORDERBY clause…

SELECT [UserName]
  FROM [MyDb].[dbo].[aspnet_Users]

…I get always a sorted result list.

I’m still very unfamiliar with SQL Server but I expected that when I add a new row to a table it is (physically) appended to the end of the table. And when I run a select statement without ORDERBY the rows will be selected in the order they were initially inserted into the database (so without any specific sort order).

I am wrong I guess. But how does it really work? Is it perhaps something special with the aspnet_Users table?

I am happy that the MemberShipUserCollection returned by GetAllUsers() is sorted but is it always guaranteed?

Thanks for info!

Update

I’ve just noticed that the database contains a stored procedure called aspnet_Membership_GetAllUsers. This procedure actually contains an ORDER BY clause by UserName. So if this stored procedure is indeed always called when I use Membership.GetAllUsers() in my code (at least if I am using the SqlMembershipProvider) it explains why the collection returned by Membership.GetAllUsers() is sorted by UserName.

Remains the question: Is Membership.GetAllUsers() actually based on this stored procedure?

  • 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-05-13T21:40:08+00:00Added an answer on May 13, 2026 at 9:40 pm

    There is a clustered Index on UserName and ApplicationID. Since you usually only use 1 applicationID then it will appear to be sorted by UserName. Data in tables are ordered by their clustered index. Which means you will usually see unsorted date return in the order of the clustered columns. However, it is NEVER guaranteed. So you must use an ORDER BY if you want the results to come back in a specific order. Any time you insert data into a table with a Clustered Index it will insert it into the table wherever if physically belongs. Look into paging and clustered vs non clustered. It will help you understand how SQL Server stores data. Look at this http://en.wikipedia.org/wiki/Clustered_index#Architecture for an overview.

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

Sidebar

Related Questions

I was wondering, what's the best approach in creating users authentication for my asp.net-mvc
I'm relatively new to ASP.NET and was wondering if anyone could shed some light
I'm wondering if there is an equivalent function to PHP's call_user_func() in ASP.NET application.
just wondering if anyone knows of a truly restful Put/delete implementation asp.net mvc preview
I am wondering what experiences people are having using the ASP.NET MVC Framework? In
I am wondering if there is a way to make ASP.NET controls play nicely
I've just learned what ASP.NET MVC is and I'm wondering if the pattern is
I am wondering what methods people are using for validating check boxes in ASP.NET
I've looked at several URL rewriters for ASP.Net and IIS and was wondering what
Was wandering if anyone uses ASP .NET membership? If you do, tell me what

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.