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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:08:21+00:00 2026-06-12T02:08:21+00:00

I have an issue, where by each user in my user list is showing

  • 0

I have an issue, where by each user in my user list is showing as on-line when I know they’re not.

When the page is loaded, they show as offline, but if I refresh the page, they all show as on-line. I’m assuming this is because I’m programmatically accessing their profile information (CommonProfile) to get the data to show on the gridview?

Is there any way to get the profile information without triggering the IsOnline property to be true?

Update:
Sorry, code is here. Please be gentle, I’m relatively new to c# & asp.net and I’m still learning.

The code is collecting information from Membership user and the common profiles and adding the fields to a datatable so that i can display the results in a gridview.

MembershipUserCollection usersList = Membership.GetAllUsers();
MembershipUserCollection filteredUsers = new MembershipUserCollection();

foreach (MembershipUser user in usersList)
{
    if (!Roles.IsUserInRole(user.UserName, "Admin") && !Roles.IsUserInRole(user.UserName, "Engineering"))
    {
        if (txtFilterCustomerNo.Text.Length > 0)
        {
            ProfileCommon PC = Profile.GetProfile(user.UserName);
            if (PC.CompanyAccountNo == txtFilterCustomerNo.Text.ToUpper())
            {
                filteredUsers.Add(user);
            }
        }
        else
        {
            filteredUsers.Add(user);
        }
    }
}

txtFilterCustomerNo.Text = null;

foreach (MembershipUser user in filteredUsers)
{
    userProfile = Profile.GetProfile(user.UserName);
    string[] userRoles = Roles.GetRolesForUser(user.UserName);

    DataRow orderLine = dataSet.Tables["UserAccounts"].NewRow();
    orderLine["USER_NAME"] = user.UserName;
    orderLine["CREATED"] = user.CreationDate;
    orderLine["LAST_LOGIN"] = user.LastLoginDate;
    orderLine["PASSWORD_CHANGED"] = user.LastLoginDate;
    orderLine["ACTIVE"] = user.IsApproved;
    orderLine["ONLINE"] = user.IsOnline;
    orderLine["LOCKED"] = user.IsLockedOut;
    orderLine["CUSTOMER_NO"] = userProfile.CompanyAccountNo;
    orderLine["HAS_INVENTORY"] = userProfile.HasOwnInventory;
    orderLine["ORDER"] = userRoles.Contains("Order");
    orderLine["REPAIR"] = userRoles.Contains("Repair");
    orderLine["WARRANTY"] = userRoles.Contains("Warranty");
    orderLine["COMMISSIONING"] = userRoles.Contains("Commissioning");
    orderLine["ACCOUNT"] = userRoles.Contains("Account");
    dataSet.Tables["UserAccounts"].Rows.Add(orderLine);
}

if (dataSet.Tables.Contains("UserAccounts"))
{
    GridView1.DataSource = dataSet.Tables["UserAccounts"];
}
  • 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-12T02:08:22+00:00Added an answer on June 12, 2026 at 2:08 am

    If you simply looked at the different overloads of GetUser, you would see that some of them take a Boolean called userIsOnline. If you specify this as false, it will not update the last online timestamp, and will not list them as online.

    var user = Membership.GetUser(userid, false);
    

    EDIT:

    I see you are using GetAllUsers() rather than GetUser(). There are some problems with GetAllUsers() and you cannot rely on the IsOnline property. Instead, you need to check the LastActivityDate field and figure out the difference between that and the current DateTime. If the amount of time is greater than what you consider “Online” to be, then they are offline, otherwise online.

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

Sidebar

Related Questions

I know this isn't a unique issue but I've not had much luck finding
I have made a simple test application for the issue, two winforms each containing
I have issue with: <form:checkboxes path=roles cssClass=checkbox items=${roleSelections} /> If previous line is used
I have an issue which I could not find answer for across the web.
I have a form with a select list, where the user can select anywhere
Possible Duplicate: Does std::list::remove method call destructor of each removed element? I have a
I have a list of <divs> with the same class. Within each <li> are
Using the script task below to stuff list of files into User::ftp_file_list. But, the
I have read lots of questions and answers about this issue on StackOverflow, but
I have issue that is reproduced on g++. VC++ doesn't meet any problems. So

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.