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 4109756
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:50:30+00:00 2026-05-20T21:50:30+00:00

Using ASP.net, is there a recommended best way to access a particular field of

  • 0

Using ASP.net, is there a recommended best way to access a particular field of the profile in code. I was looking in my old Problem-Design-Solution 2.0 book, and it does it by pulling all members in the DB and then iterating through each one’s profile (see code below). Is there a better way?

for each (MembershipUser user in Membership.GetAllUsers())
{
    ProfileCommon userProfile = profile.GetProfile(user.UserName);
    if (userProfile.mysetting == desiredValue)
    { 
         //do something
    }
}

Edit 1

I found that it can be done a little more efficiently than pulling members and then pulling profiles. It is possible that not all members have a profile, so if you use the following code, you’ll pull all the profiles (which may be fewer in number than members, and then can iterate across it:

for each (ProfileInfo theProfile in ProfileManager.GetAllProfiles (ProfileAuthenticationOption.All)
{
    ProfileCommon pc = ProfileBase.Create(theProfile.UserName)
    if (pc.mysetting == desiredValue)
    {
        //do something
    }
}

It still round trips the DB for each profile, but it may not do it as many as if we used the members…

  • 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-20T21:50:31+00:00Added an answer on May 20, 2026 at 9:50 pm

    With built-in Profiles, no there isn’t a better way. One option as provided by Tim is Table Profile provider or writing your own profile provider.

    Or you can go completely other route i.e. storing profile information in your own custom table.

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

Sidebar

Related Questions

Using ASP.Net MVC 2, is there any way to use the RedirectToAction() method of
I'm looking at using Subsonic with a multi-tenant ASP.net web application. There are multiple
Is there a way using asp.net/jquery to toggle a div visibility when using a
Is there a way of using ASP.NET user-controls (.ascx files) to fill my own
I'm using ASP.NET 4. C#. Is there anyway to call a Javascript function or
Regarding separations of concerns only, are there advantages of using ASP.NET MVC instead of
IIS6 http compression with ASP.NET: is there any disadvantage especially when using ajax updatepanel
I'm using the ASP.NET SQL Membership Provider. So, there's an aspnet_Users table that has
I am just getting into more client-side stuff in ASP.NET using Javascript, and there's
I'm using the Contrib Grid for ASP.NET MVC and I was wondering if there

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.